|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
messageId |
« View previous topic :: View next topic » |
Author |
Message
|
vivekkooks |
Posted: Tue Aug 05, 2003 1:10 am Post subject: messageId |
|
|
 Voyager
Joined: 11 Jun 2003 Posts: 91
|
Hello,
I have installed MQSeries on Linux/Intel.
I want to send the message Id across messages. But when I 'get' the message, I am not getting the message Id which I set for 'put'.
Code:
PUT:
-----
ImqMessage msg;
ImqQueue queue;
ImqBinary binMsgId;
char bufferId[100] = "msgID1";
char bufferData[100]= "Hello";
binMsgId.set((char*)buffer,strlen(buffer));
msg.setMessageId(binMsgId);
msg.useEmptyBuffer( bufferData, sizeof( bufferData ) );
msg.setMessageLength( strlen(bufferData) );
queue.put(msg);
GET:
-----
ImqMessage msg;
ImqQueue queue;
ImqBinary binMsgId;
msg.setMessageId();
queue.get(msg);
cout<<"Message is:"<<msg.bufferPointer( ) <<endl;
binMsgId = msg.messageId();
cout<<"Message Id is "<<binMsgId.dataPointer()<<endl;
I am not getting message Id as "msgID1", which I am setting during put message.
Any Clue? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Aug 05, 2003 6:23 am Post subject: Re: messageId |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
vivekkooks wrote: |
Hello,
I am not getting message Id as "msgID1", which I am setting during put message.
Any Clue? |
The Message ID field in the MQMD is not a character buffer, it's a binary buffer. So what you read back is a bit stream, and not a character stream. |
|
Back to top |
|
 |
vivekkooks |
Posted: Tue Aug 05, 2003 7:49 am Post subject: |
|
|
 Voyager
Joined: 11 Jun 2003 Posts: 91
|
Hello,
the problem is not with binary stream.
Infact I am getting null data instead.
The same problem holds true if I use setApplicationIdData(char*) in 'put' message. I am not geting the same applicationIdData() after I 'get' the message. |
|
Back to top |
|
 |
vivekkooks |
Posted: Wed Aug 20, 2003 3:27 am Post subject: |
|
|
 Voyager
Joined: 11 Jun 2003 Posts: 91
|
The Problem is solved.
code(put):
ImqMessage msg;
char msgID[MQ_MSG_ID_LENGTH]={'\0'}; // MQ_MSG_ID_LENGTH is reqd
ImqBinary binMsgId;
binMsgId.set((char*)msgID,sizeof (msgID));
msg.setMessageId(binMsgId); |
|
Back to top |
|
 |
rich5986 |
Posted: Wed Aug 20, 2003 9:39 am Post subject: setApplicationIdData() not working?! |
|
|
Newbie
Joined: 20 Aug 2003 Posts: 1
|
I have been having the same problem with the setApplicationIdData() method.
I call it on a message passing in something like "Zproj1", then put() the message. The system executing gets cannot see the app id, and the app id is empty if I view the message in MQSeries Explorer.
In C++, I added
#define protected public
then printed out the contents of the "MQMD2 omqmd;" protected member of ImqMessage. It worked that far: looks like the setApplicationIdData() function correctly put my value into the ImqMessage object successfully, but whatever the put() method call does, it doesn't pass it along.
Help! Any ideas?
- Rich |
|
Back to top |
|
 |
bower5932 |
Posted: Thu Aug 21, 2003 5:50 am Post subject: |
|
|
 Jedi Knight
Joined: 27 Aug 2001 Posts: 3023 Location: Dallas, TX, USA
|
I thought that you had to pass in the appropriate flag on the MQPMO to indicate that you were doing something with the context. If you didn't do this, MQ set the context for you regardless of what you specified. There are details in the APR and APG. |
|
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
|
|
|
|