|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
problem in message buffer |
« View previous topic :: View next topic » |
Author |
Message
|
vivekkooks |
Posted: Thu Jul 31, 2003 10:25 pm Post subject: problem in message buffer |
|
|
 Voyager
Joined: 11 Jun 2003 Posts: 91
|
Hello,
I am using MQSeries C++ on Linux/Intel.
While getting the message, I do not want to give a fixed buffer for reading message so that the message of any length can be received.
So, I am not providing the user buffer while getting the message.
But if get a long message first and short message after that, The bufferPointer (or dataPointer ) is appending the data of previous message.
Code:
loop(1)
{
ImqMessage msg;
ImqQueue queue;
queue.get(msg);
cout<<msg.bufferPointer()<<endl;
}
If I put a message containg "Hello" followed by "Hi",
bufferpointer prints the following value:
Hello
Hillo
I even tried msg.clearMessage() before getting the message.
But it is not working.....
Any clues about this? |
|
Back to top |
|
 |
psanders |
Posted: Fri Aug 01, 2003 5:11 am Post subject: |
|
|
Apprentice
Joined: 02 Apr 2002 Posts: 27
|
The length of the message retrieved is in the message header. I'm not a C guy but it's probably something like msg.length. Hope that helps till you get a response from someone who knows. |
|
Back to top |
|
 |
mqonnet |
Posted: Fri Aug 01, 2003 5:47 am Post subject: |
|
|
 Grand Master
Joined: 18 Feb 2002 Posts: 1114 Location: Boston, Ma, Usa.
|
Firstly, msg.clearMessage() does NOT clear the message data from the message buffer. From the manuals.
void clearMessage( );
Sets the message length and data offset both to zero.
Now, i havent done this myself. But i think you have to play around a little with "useEmptyBuffer" and "automatic buffer". From the docs it says that you could use, useemptybuffer to let the OS automatically allocate more or less memory as and when needed.
Another suggestion would be to do a browse before the get, so you can get the message length and you allocate appropriate sized buffer to do the actual get. All this isnt good performance wise, but ifyou are looking to manage memory.
Hope this helps.
Cheers
Kumar |
|
Back to top |
|
 |
vivekkooks |
Posted: Fri Aug 01, 2003 11:33 pm Post subject: |
|
|
 Voyager
Joined: 11 Jun 2003 Posts: 91
|
The problem is solved. I have to explicitly create and destroy ImqMessage object everytime.
thanks, |
|
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
|
|
|
|