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's

Post new topic  Reply to topic
 Message ID's « View previous topic :: View next topic » 
Author Message
spoimala
PostPosted: Wed Feb 20, 2002 4:47 am    Post subject: Reply with quote

Novice

Joined: 05 Feb 2002
Posts: 10

I'm doing a component that reads and writes messages to/from a queue (C++ MQI API).
When I write a message to queue, how do I know, what is the ID of that message so I can read it from queue?

How long messages stay in queue? If I put three messages tu queue, can I read them in reverse order (or whatever order)?
Back to top
View user's profile Send private message Send e-mail
jhalstead
PostPosted: Wed Feb 20, 2002 5:29 am    Post subject: Reply with quote

Master

Joined: 16 Aug 2001
Posts: 258
Location: London

As you pass the MQMQ structure into MQPUT it is populated by MQSeries, so if you look at MQMD.MsgId after putting a message you should have the message id available for use.

The Application programming Guide and Application Programming reference are essential reads to assist in MQSeries development.

http://www-4.ibm.com/software/ts/mqseries/library/mqpdfs.html

Jamie
Back to top
View user's profile Send private message Send e-mail
mqonnet
PostPosted: Wed Feb 20, 2002 6:32 am    Post subject: Reply with quote

Grand Master

Joined: 18 Feb 2002
Posts: 1114
Location: Boston, Ma, Usa.

I'm doing a component that reads and writes messages to/from a queue (C++ MQI API).
When I write a message to queue, how do I know, what is the ID of that message so I can read it from queue?

How long messages stay in queue? If I put three messages tu queue, can I read them in reverse order (or whatever order)?

As explained already, you get the message id after the call to MQPUT. The md.MsgId has the message id generated by the Queue manager for you. Remember you need to call MQPUT with NEW_MSG_ID, so that each message has a unique message id generated by the qm.

A message stays on the queue until it is retrieved from the Queue, Destructively, or is expired. This is the most common scenario.
You can retrive a message in any order you wish in as many ways. In your case, since you already have message id's for all the messages you could use messageid as the key to retrieve the messages.

Cheers
Kumar


_________________
IBM Certified WebSphere MQ V5.3 Developer
IBM Certified WebSphere MQ V5.3 Solution Designer
IBM Certified WebSphere MQ V5.3 System Administrator
Back to top
View user's profile Send private message Send e-mail Visit poster's website
spoimala
PostPosted: Wed Feb 20, 2002 11:28 pm    Post subject: Reply with quote

Novice

Joined: 05 Feb 2002
Posts: 10

Okay, thanks guys.
But one problem. How can I access this MQMD structure as it's protected member of IMqMessage? I don't find a method in Message class to set/get these members.
(They told in that book, I should set these to null in order to have unique IDs). Where do I set the NEW_MSG_ID?
You guys speak about calling MQPUT it means calling ImqQueue.put? It takes one or two parameters: ImqMessage and ImqPutMessageoptions. In PMO, there are MsgID.

Thanks.
Back to top
View user's profile Send private message Send e-mail
spoimala
PostPosted: Wed Feb 20, 2002 11:52 pm    Post subject: Reply with quote

Novice

Joined: 05 Feb 2002
Posts: 10

In one book (http://www-3.ibm.com/software/ts/mqseries/txppacs/supportpacs/imqi.pdf) they say that there are methods setCorrelation id and set/getMessageID (but no getCorrelation ID).
But those methods are not available in my API. Are there many version of MQI (I didn't find a version number in the header files)
Back to top
View user's profile Send private message Send e-mail
spoimala
PostPosted: Thu Feb 21, 2002 1:42 am    Post subject: Reply with quote

Novice

Joined: 05 Feb 2002
Posts: 10

Strange, I don't find those methods in header file (neither does the intellisense of Visual Studio) but compiler doesn't complain when I add the methods...
Okay, now I have access the message and correlation IDs, but they are ImqBinary. Is it impossible to just use integers?
(I have to marshal them over COM and use from C#)
Are there any good tutorials or samples how to handle these things?
I found one good example, but it uses ImBinary internally
(http://www.developer.ibm.com/tech/sample_code_handler.pl?action=display&object=/tech/sample_code/mq/mqreq.cpp)
Back to top
View user's profile Send private message Send e-mail
pchan
PostPosted: Thu Feb 21, 2002 8:27 am    Post subject: Reply with quote

Newbie

Joined: 20 Feb 2002
Posts: 3

spoimala,

I am encountering the same issue with C++. Could you post and describe how you've added the method to reset the MQMD.MsgId? I appreciate any help. Thanks.
Back to top
View user's profile Send private message Send e-mail
spoimala
PostPosted: Fri Feb 22, 2002 12:27 am    Post subject: Reply with quote

Novice

Joined: 05 Feb 2002
Posts: 10

As I told in my previous post, you can just put

ImqMessage msgRequest;
// clip---clap---
msgRequest.setMessageId();
msgRequest.setCorrelationId();
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

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