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 API Support » Message ID

Post new topic  Reply to topic
 Message ID « View previous topic :: View next topic » 
Author Message
justrob
PostPosted: Tue Jun 01, 2004 11:34 am    Post subject: Message ID Reply with quote

Apprentice

Joined: 30 Apr 2004
Posts: 26

I have a JAVA client that is putting messages into a queue - that seemed to work for weeks... now it appears that it is using the same messageID on each message.

What needs to be done to ensure the JAVA client is using unique mesage id's?

Is it as simple as (MQPMO.Options) MQPMO_NEW_MSG_ID??

Thanks
Back to top
View user's profile Send private message
kirani
PostPosted: Tue Jun 01, 2004 10:47 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

You go it!
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
justrob
PostPosted: Wed Jun 02, 2004 4:54 am    Post subject: Thanks Reply with quote

Apprentice

Joined: 30 Apr 2004
Posts: 26

Thanks for the response, I'll hassle the developer now
Back to top
View user's profile Send private message
jigjim
PostPosted: Mon Jun 07, 2004 12:36 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

That dosent work !!!
It keeps generating the same ID most of the times.

Instead i used this and it works :

msg.messageId = String.valueOf(Math.random()).getBytes();

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 07, 2004 12:43 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
That dosent work !!!
It keeps generating the same ID most of the times.


Prove it!

You're probably trying to treat the message ID as a String, either for application purposes or for debugging purposes.

And that's not a valid procedure in either case.

http://www.mqseries.net/phpBB2/viewtopic.php?t=15736&highlight=message+id
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Mon Jun 07, 2004 1:12 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

I guess ur right on the part where non printable charachetrs makes it difficult to realise that the byte array will be different.

However since we need "bytes" to be assigned to messageID, I found my solution a quick, easy and relaible way to achive the purpose of generating unique random id's.

Why do you think it is not a valid "procedure" in either case.

I send the message onto teh Q using this id . then i pass the string variable to my read message function and set that as my read msg's correlation id. That way i get the response back to the rquest i sent?

Is there a better way to do it ?

Thanks

Jigs
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 07, 2004 1:20 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jigjim wrote:
I guess ur right on the part where non printable charachetrs makes it difficult to realise that the byte array will be different.

However since we need "bytes" to be assigned to messageID, I found my solution a quick, easy and relaible way to achive the purpose of generating unique random id's.

It's not reliable at all, as long as it treats a byte array as a String in any fashion.

jigjim wrote:
Why do you think it is not a valid "procedure" in either case.

I didn't say your code wasn't valid. I said that it is not valid to treat a Byte array as a String.

jigjim wrote:
I send the message onto teh Q using this id . then i pass the string variable to my read message function and set that as my read msg's correlation id. That way i get the response back to the rquest i sent?

Is there a better way to do it ?


Yes. The better way to do it is to understand what you are actually using, which is a Byte array and not a String value.

Treating a Byte array as a String is the wrong thing to do. It's that simple.

Strings can contain only a subset of the possible values that Bytes can contain. You have no guarantees that any application you are talking to will make the same mistake and treat a Byte array as a String - and so you have no guarantees that you will get a response back to the request you send.

No guarantees at all.

Please read the manuals. Please. Please.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
jigjim
PostPosted: Mon Jun 07, 2004 1:48 pm    Post subject: Reply with quote

Apprentice

Joined: 30 Mar 2004
Posts: 41

Thank you for the positive feedback.
Can you please refer to some of the manuals that I should read.

Also MQC.MQPMO_NEW_MSG_ID geneartes an "int" value which I will have to recast as bytes array. That should keep String out of the picture.

More importantly, i guess the gist of what you mean is:
Passing the String value to my msg retrieval function is incorrect. I should instead pass the bytes array so that it can be directly set as the corealtion id of my msg to be retrieved.

Can you pls pass/show some references on sample codes using the message ID and Corelation ID using Java.

Thanks

Jigs
Back to top
View user's profile Send private message
EddieA
PostPosted: Mon Jun 07, 2004 2:31 pm    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
Also MQC.MQPMO_NEW_MSG_ID geneartes an "int" value which I will have to recast as bytes array. That should keep String out of the picture.

I think you're misunderstanding the use of this. MQPMO_NEW_MSG_ID is a value you set in the Put Message Options. It tells MQ to generate, and populate, a new MessageID in the message you are PUTting.

Start with the Application Programmers Guide, together with the Java manual. Then for reference, the Application Programmers Reference.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Message ID
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.