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 IBM MQ Support » Getting the message size without retrieving the message

Post new topic  Reply to topic
 Getting the message size without retrieving the message « View previous topic :: View next topic » 
Author Message
pezi
PostPosted: Tue Apr 15, 2008 3:17 am    Post subject: Getting the message size without retrieving the message Reply with quote

Novice

Joined: 08 Feb 2008
Posts: 15
Location: Vienna/Austria

Hi,

Is there a possibility to get the actual message size for an MQ-message without retrieving it?
I'd like to avoid that always the max. message length defined in the queue is allocated.
When I am using MO71 I see the message size already in the table listing the messages and I think that it was not loading all messages to get this information so there must be an API function doing this.

Regards
Peter
Back to top
View user's profile Send private message Visit poster's website
Gaya3
PostPosted: Tue Apr 15, 2008 3:33 am    Post subject: Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

you can get those through MQMD Properties.


Regards
Gayathri
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Apr 15, 2008 3:33 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Sure. You can MQGMO_BROWSE+MQGMO_ACCEPT_TRUNCATED_MSG(or whatever it is...) with a buffer size of 1.

This will give you the MQMD with the actual message size. Then you can allocate buffer and GET_MSG_UNDER_CURSOR
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mvic
PostPosted: Tue Apr 15, 2008 8:14 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

jefflowrey wrote:
Sure. You can MQGMO_BROWSE+MQGMO_ACCEPT_TRUNCATED_MSG(or whatever it is...) with a buffer size of 1.

This will give you the MQMD with the actual message size. Then you can allocate buffer and GET_MSG_UNDER_CURSOR

With browse-get the MQGMO_ACCEPT_TRUNCATED_MSG is a moot point in this context. With non-browse get (... yes I know this is not what you said jeff) don't use MQGMO_ACCEPT_TRUNCATED_MSG in this context as this will accept the message truncated to fit in your 1-byte buffer.

Two solutions to this: (a) use browse then non-browse get (b) use get with buffer size of 0, without MQGMO_ACCEPT_TRUNCATED_MSG, then a non-browse get with the right buffer length.

In either case you can still miss the message if another getter is active on the same queue. If you are the only getter on the queue then you're OK.

There are better ways of doing this if performance matters to you - eg. pre-allocating a large enough buffer for all of the messages you ever expect to see. Uses more memory, but goes faster.


Last edited by mvic on Tue Apr 15, 2008 10:32 am; edited 1 time in total
Back to top
View user's profile Send private message
EddieA
PostPosted: Tue Apr 15, 2008 9:05 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Gaya3 wrote:
you can get those through MQMD Properties.

The message length isn't part of any header.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
bruce2359
PostPosted: Tue Apr 15, 2008 9:58 am    Post subject: Reply with quote

Poobah

Joined: 05 Jan 2008
Posts: 9442
Location: US: west coast, almost. Otherwise, enroute.

Quote:
The message length isn't part of any header

It's returned as DataLength (MQLONG). See MQGET in the APR manual.
_________________
I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live.
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 IBM MQ Support » Getting the message size without retrieving the message
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.