ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Help. how to manual set Msgid of message

Post new topic  Reply to topic
 Help. how to manual set Msgid of message « View previous topic :: View next topic » 
Author Message
fredlee
PostPosted: Mon Aug 02, 2004 7:09 pm    Post subject: Help. how to manual set Msgid of message Reply with quote

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
View user's profile Send private message
gunter
PostPosted: Mon Aug 02, 2004 11:09 pm    Post subject: Reply with quote

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
View user's profile Send private message
fredlee
PostPosted: Tue Aug 03, 2004 11:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 04, 2004 5:14 am    Post subject: Reply with quote

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
View user's profile Send private message
bduncan
PostPosted: Wed Aug 04, 2004 9:20 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Help. how to manual set Msgid of message
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.