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 » General Discussion » problem in message buffer

Post new topic  Reply to topic
 problem in message buffer « View previous topic :: View next topic » 
Author Message
vivekkooks
PostPosted: Thu Jul 31, 2003 10:25 pm    Post subject: problem in message buffer Reply with quote

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
View user's profile Send private message
psanders
PostPosted: Fri Aug 01, 2003 5:11 am    Post subject: Reply with quote

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
View user's profile Send private message
mqonnet
PostPosted: Fri Aug 01, 2003 5:47 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
vivekkooks
PostPosted: Fri Aug 01, 2003 11:33 pm    Post subject: Reply with quote

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
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 » General Discussion » problem in message buffer
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.