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 » Confused on how to get MQMD fields from ImqMessage

Post new topic  Reply to topic Goto page 1, 2  Next
 Confused on how to get MQMD fields from ImqMessage « View previous topic :: View next topic » 
Author Message
danhoffman
PostPosted: Wed May 31, 2006 12:26 pm    Post subject: Confused on how to get MQMD fields from ImqMessage Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

Hi,

I'm using ImqMessage in the C++ api to get messages from a queue. I see classes like ImqMessageTracker but I'm not sure how they interact with ImqMessage. For example, I don't see any functions that will return an ImqMessage object, nor any way to pass a pointer or reference to one on the ImqQueue.get call. How can I get the correlid, msgid, etc. once I have an ImqMessage object? (Note, I don't need to query by msgid or correlid, I just want to know it for every message that I get).

Thanks.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 12:50 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.amqzan.doc/amqzan09101.htm

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.amqzan.doc/amqzan09103.htm
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 12:55 pm    Post subject: I have those links Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

jeff,

I have those links. Still confused. I do not see any functions inside ImqMessage that get me the ImqMessageTracker. The MQMD. Do you have any sample code that shows instantiating the ImqMessageTracker, doing a get off of the queue and accessing the MQMD?

Dan
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 1:06 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The second link I posted says *to me* that if I have an ImqMessage object called "myMsg", then if I want to get the MQMD, I can access "myMsg.MQMD" and then access the individual fields under that as if it were a normal MQMD C structure.

And the first link says that *to me* (my C++ is rusty), that if I want to get the PutTime as an ImqString I can call "myMsg.putTime()", and have an ImqString* returned to me.

I don't know why one would use an ImqMessageTracker, myself. It seems to only have a subset of fields of the MQMD. Maybe you can use it to specify match options without having to build a full ImqMessage object.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 2:58 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

jefflowrey wrote:
The second link I posted says *to me* that if I have an ImqMessage object called "myMsg", then if I want to get the MQMD, I can access "myMsg.MQMD" and then access the individual fields under that as if it were a normal MQMD C structure.


That's the thing - the MQMD has 'protected' access which means I would have to descend my own class from ImqMessage just to try and get it. (It just doesn't seem like the 'right' thing to have to do ).
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 2:59 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Right, but all the fields of the MQMD should be available through the public methods listed in the first link.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 4:25 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

jefflowrey wrote:
Right, but all the fields of the MQMD should be available through the public methods listed in the first link.


They don't - at least not for msgid and correlation id, which are the ones I'm primarily concerned with. (That's why I started this thread...)
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 4:43 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Probably a bug in the documentation.

The imqsget.cpp sample code shows
Code:
msg.setMessageId( );
msg.setCorrelationId( );

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 4:46 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

jefflowrey wrote:
Probably a bug in the documentation.

The imqsget.cpp sample code shows
Code:
msg.setMessageId( );
msg.setCorrelationId( );


I don't want to SET it, I want to GET it!
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 4:58 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes.

I'm assuming that the analog would be "msg.MessageId();", or perhaps "msg.messageId();" - since that's the naming standard the classes use for all of the other fields.

But I'm not willing to try and throw together a C++ compilation environment to test it.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 5:02 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

I've grepped for it in /opt/mqm/inc, and it only exists in the ImqMessageTracker.... feels like we're going in circles, doesn't it?

|/opt/mqm/inc> grep -i messageid *
imqmtr.hpp: void * opvoidMessageId ;
imqmtr.hpp: ImqBinary messageId ( ) const ;
imqmtr.hpp: ImqBoolean setMessageId ( const ImqBinary & );
imqmtr.hpp: void setMessageId ( const unsigned char * = 0 );
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed May 31, 2006 6:44 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

What happens when you just try it?

What happens when you, for example, cast an ImqMessage as an ImqMessageTracker object?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
danhoffman
PostPosted: Wed May 31, 2006 6:47 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

Yeah, already tried that. I also tried to descend from ImqMessage to make the MQMD useable, didn't work. Just looks like the C++ api is not complete and that my alternative is java or C.
Back to top
View user's profile Send private message
bower5932
PostPosted: Wed May 31, 2006 7:02 pm    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

Take a look at mqreqro.cpp and mqsrvro.cpp out at:

http://www-304.ibm.com/jct09002c/isv/tech/sampmq.html

They do some manipulation of the message and correlation ids. They might have what you are looking for.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
danhoffman
PostPosted: Wed May 31, 2006 7:07 pm    Post subject: Reply with quote

Apprentice

Joined: 03 Nov 2005
Posts: 25

It turns out that ImqMessage descends from ImqMessageTracker and ImqCache (I found this out only by looking at the .hpp file)

Therefore, all methods from ImqMessageTracker and ImqCache can be called on an ImqMessage object. (So the messageId() function works).

Thanks for your help.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » IBM MQ API Support » Confused on how to get MQMD fields from ImqMessage
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.