|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Setting Message ID for a Message |
« View previous topic :: View next topic » |
Author |
Message
|
sumeet |
Posted: Tue Mar 16, 2004 3:48 pm Post subject: Setting Message ID for a Message |
|
|
Novice
Joined: 16 Mar 2004 Posts: 16
|
Hi all,
I understand that we can not use the setJMSMessageID () function to set a message ID for an outbound message when using JMS.
My questions are:
a) Is there a way to set the message ID by using WebSphere MQ Base Java? I went through the WebSphere MQ Using Java book but could not find out how to set the message ID.
b) If at all, it is possible, then are we not allowing the possibility of two messages having the same message ID?
Please advice,
Thanks & Regards,
Sumeet
Last edited by sumeet on Tue Mar 16, 2004 5:18 pm; edited 1 time in total |
|
Back to top |
|
 |
EddieA |
Posted: Tue Mar 16, 2004 5:06 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Is there a way to set the message ID by using WebSphere MQ Base Java or WebSphere MQ JMS |
a) In the plain ole' Base Java API, messageId is a byte variable of MQMessage, so you just set it with what you want. If you use MQC.MQMI_NONE, then the Queue Manager will generate a unique message ID for you.
For JMS, you answered your own question:
Quote: |
we can not use the setJMSMessageID () function to set a message ID |
b) When MQ generates the message ID, it is always unique.
Cheers _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
sumeet |
Posted: Tue Mar 16, 2004 5:17 pm Post subject: Setting Message ID for a Message |
|
|
Novice
Joined: 16 Mar 2004 Posts: 16
|
Hi Eddie,
Thanks for the response to confirm that message ID can be set.
Second part of my question is still unanswered though, as to how do I actually set the message ID. As I had mentioned, I could not locate any place where it was mentioned, any pointers to that or to a piece of code would be of great help.
When MQ generates a message ID, it is always unique but when we generate message IDs, we run the risk of having 2 messages on the network with the same message ID. Does that not pose any problems?
Also, it means that if I want to play around with the message ID then I need to use MQ Base Java (MQ Specific code).
Cheers,
Sumeet |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 16, 2004 8:19 pm Post subject: Re: Setting Message ID for a Message |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
sumeet wrote: |
Second part of my question is still unanswered though, as to how do I actually set the message ID. |
Actually, no, Eddie did answer this question.
EddieA wrote: |
In the plain ole' Base Java API, messageId is a byte variable of MQMessage, so you just set it with what you want. |
The message id is a field of the MQMessage object, that contains a byte array. You simply assign a proper byte value to it. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
EddieA |
Posted: Tue Mar 16, 2004 10:48 pm Post subject: |
|
|
 Jedi
Joined: 28 Jun 2001 Posts: 2453 Location: Los Angeles
|
Quote: |
Does that not pose any problems? |
Only if you want to use the MessageId as a way to retrieve messages. Otherwise, no.
Cheers, _________________ Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0 |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 17, 2004 6:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
EddieA wrote: |
Quote: |
Does that not pose any problems? |
Only if you want to use the MessageId as a way to retrieve messages. Otherwise, no. |
Or otherwise use the MessageID as a unique identifier for a particular message - in logs or archives or whatever.
Basically, it's only a problem to have non-unique Message IDs if you are doing things that assume they are unique.
But I wouldn't set all my message id's to the same thing. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|