Author |
Message
|
fredlee |
Posted: Mon Aug 02, 2004 7:09 pm Post subject: Help. how to manual set Msgid of message |
|
|
 Newbie
Joined: 02 Aug 2004 Posts: 6 Location: Hong Kong
|
I now need to manually assign the message id of put message. How can I do it. Some code fragment as follow:
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.options = MQC.MQPMO_NONE;
byte[] a = new byte[(int)001];
messagePut.messageId = a;
RequestMQ.put(messagePut, pmo);
System.out.print("\nPut ID: ");
dumpHexId(messagePut.messageId);
when I print the message ID, it still using the system value. Please help
 |
|
Back to top |
|
 |
gunter |
Posted: Mon Aug 02, 2004 11:09 pm Post subject: |
|
|
Partisan
Joined: 21 Jan 2004 Posts: 307 Location: Germany, Frankfurt
|
Is it this what you try to do ?
Code: |
byte[] a = new byte[1];
a[0] = 1;
messagePut.messageId = a;
|
_________________ Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3 |
|
Back to top |
|
 |
fredlee |
Posted: Tue Aug 03, 2004 11:39 pm Post subject: |
|
|
 Newbie
Joined: 02 Aug 2004 Posts: 6 Location: Hong Kong
|
In my original message, I want to find the coding to manually assign message ID for MQ java client.
I have found in the code in IBM MQ sample now.
But can anyone suggest the best ways to generate the unique numeric message ID.
Thanks. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Aug 04, 2004 5:14 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
fredlee wrote: |
But can anyone suggest the best ways to generate the unique numeric message ID. |
There are better ways to do whatever it is you are trying to do with a numeric Message ID.
It is recommended practice that you allow the system to generate unique message IDs for you, and simply work with the fact that they are neither strings nor numbers but binary data. It's no harder to work with binary data than it is to work with strings or numbers! _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bduncan |
Posted: Wed Aug 04, 2004 9:20 am Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
If you are trying to encode some application-specific information in the MsgId, as Jeff points out, there are better ways to do this. There are other fields in the MQMD, like the CorrelId, that you can use to put your own information in. It is best to leave the generation of the MsgId up to the queue manager. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
|