Author |
Message
|
skytorch |
Posted: Wed Nov 06, 2002 8:50 am Post subject: URGENT: Java and C++ Interoperability Design Issue |
|
|
 Apprentice
Joined: 10 Jun 2002 Posts: 47 Location: New York City
|
Hi,
We have a C application and a Java application that need to exchange messages on several IBM MQ 5.1 queues. What's the best way to achieve this?
option 1. if both Java and C app use MQI protocol to put and get messages, do we have to consider Java and C++ data type conversions and other issues ?
option 2. if we let Java app to use JMS to interact with the queues, meanwhile still let C app to use MQI. is it going to solve interop problem ? what's the downside of doing this ?
option 3. ?
Thanks in advance
Sky |
|
Back to top |
|
 |
skytorch |
Posted: Thu Nov 07, 2002 10:25 am Post subject: |
|
|
 Apprentice
Joined: 10 Jun 2002 Posts: 47 Location: New York City
|
One more thing -
If I've a data structure in Java, is there a way for C or C++ application to be able to use a similar data structure (such as structure). And vice versa. Basically, can I do anything more than passing around tag-value pairs ?
Thanks in advance.
Sky |
|
Back to top |
|
 |
RogerLacroix |
Posted: Thu Nov 07, 2002 9:25 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
Sure, you can pass 'C' structures between a 'C' program and a Java program. This is better than tag-value pairs.
But if you are going to use tag-value pairs, then why don't you use XML instead?
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
skytorch |
Posted: Fri Nov 08, 2002 6:44 am Post subject: |
|
|
 Apprentice
Joined: 10 Jun 2002 Posts: 47 Location: New York City
|
Roger,
We're concerned with performance of XML over tag-value pair since we're doing a trading system.
If you've a C structure like this:
struct User {
char* name;
int id;
char* address;
}
how do you get it from Java MQMessage API. is it represented as a Java Object imbeded in the MQMessage ? If so, what's the Java representation of this C struct ?
Also, if you've a java object imbeded in a MQMessage sent by a Java application to a queue like this:
class Firm {
String name;
String location;
int employees;
public String getName();
}
How do you get this info in your C application that is retrieving messages from this same queue ?
Thanks.
Sky |
|
Back to top |
|
 |
skytorch |
Posted: Tue Nov 12, 2002 8:33 am Post subject: |
|
|
 Apprentice
Joined: 10 Jun 2002 Posts: 47 Location: New York City
|
hello, are those mq experts (duncan, potkay, yoda) still with this forum? i don't see replies that i used to see a lot. what's going on. |
|
Back to top |
|
 |
RogerLacroix |
Posted: Tue Nov 12, 2002 10:02 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
I swear I posted an answer the other day. Hummm.
I would do neither. Do not put a class object as a message unless the receiving application is written in Java (way, way too much work).
Secondly, do not put 'C' pointers in a message - it won't do the receiving application any good (e.g. char* name; and char* address; are pointers).
Use something like:
Code: |
struct User {
char name[50];
char id[12];
char address[50];
} |
Convert your integer to a string before you send it. That way you can mark the message format as "MQSTR". Therefore, you can get the queue manager to convert the message between different platform types.
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|