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 » QM for .Net: How to test and return length of message in GET

Post new topic  Reply to topic
 QM for .Net: How to test and return length of message in GET « View previous topic :: View next topic » 
Author Message
lifeng
PostPosted: Fri Feb 15, 2008 9:15 am    Post subject: QM for .Net: How to test and return length of message in GET Reply with quote

Apprentice

Joined: 11 Jan 2008
Posts: 46

Hi,

I am converting my C program for UNIX to .Net with MQ for .Net. One functionality we need is that, on UNIX, we want to use exact buffer length to GET a message out of a queue. So prior to reading a message from a queue, we browse the queue with a buffer length set to 0. On the way back, we will get a fail reason code (indicating that the buffer length is 0) and a value of the true length of the message. We will use this buffer length then to browse(read) again.

That works all fine on UNIX but how should I do it with .Net API? First of all, do I even need to worry about the buffer length any more when I call GET using .Net API? And if I do, how do I specify a buffer length?

Thanks in advance!

Lifeng
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Feb 15, 2008 10:50 am    Post subject: Re: QM for .Net: How to test and return length of message in Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

lifeng wrote:
on UNIX, we want to use exact buffer length to GET a message out of a queue. So prior to reading a message from a queue, we browse the queue with a buffer length set to 0.


Why (in a what's the requirement sense)? The call returns the actual length of the message in the buffer, so set the buffer to the maximum predicted length (I usually set it to the queue's maximum message length for obvious reasons) and read the message.


lifeng wrote:
That works all fine on UNIX but how should I do it with .Net API? First of all, do I even need to worry about the buffer length any more when I call GET using .Net API? And if I do, how do I specify a buffer length?


No more than you need to on Unix (i.e. no) but it depends on your requirement. IIRC there's a ResizeBuffer method on the Message object so you could set it to zero, catch the exception, resize the buffer and read again.

But it would be complex & requires 2 read opperations. Which of course your current method does.

I do have a vague memory that the method is not absolute, but is an advisory size (like the register keyword on a modern C compiler!) so I'm not convinced that setting it to zero would actually work.

The .NET manual will be authorative on this topic.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Feb 15, 2008 11:19 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

And please remember that if you are going towards fully managed code you should also look into c# instead of managed c or managed c++ as this API is much closer to the Java api and takes the worry of memory management out of your hands.

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » QM for .Net: How to test and return length of message in GET
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.