|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
QM for .Net: How to test and return length of message in GET |
« View previous topic :: View next topic » |
Author |
Message
|
lifeng |
Posted: Fri Feb 15, 2008 9:15 am Post subject: QM for .Net: How to test and return length of message in GET |
|
|
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 |
|
 |
Vitor |
Posted: Fri Feb 15, 2008 10:50 am Post subject: Re: QM for .Net: How to test and return length of message in |
|
|
 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 |
|
 |
fjb_saper |
Posted: Fri Feb 15, 2008 11:19 am Post subject: |
|
|
 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 |
|
 |
|
|
 |
|
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
|
|
|
|