|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using MQGET in PERL |
« View previous topic :: View next topic » |
Author |
Message
|
bmeshier |
Posted: Mon Feb 02, 2004 10:53 am Post subject: Using MQGET in PERL |
|
|
Newbie
Joined: 02 Feb 2004 Posts: 1 Location: Indianapolis, IN
|
Our partner has chosen MQ as the platform to send XML messages back and forth. I've been chosen to do the implementation (and I know nothing about MQ). They run the MQ server on Windows and we use Linux. I'm currently writing some PERL scripts to get messages from them and insert in to our database for processing. This is my second week learning MQ, so if anyone can point me to some reference material, it would be much appreciated. Now, here is my question:
Assuming there are 100 messages waiting for me to GET which vary in size from a couple kilobytes to as large as 3MB. First question is, how does one retrieve a message larger than the bufferlen?
Here is my snippit of code.
Code: |
my $bufferlen = 100;
my $MsgDesc = {MQMD_DEFAULT};
my $GetMsgOpts = { Options => MQGMO_FAIL_IF_QUIESCING | MQGMO_WAIT, WaitInterval => 1000, MatchOptions => MQMO_NONE };
$Msg = MQGET($Hconn, $Gobj, $MsgDesc, $GetMsgOpts, $bufferlen, $cc, $re);
|
What is the maximum bufflen that can be set?
Do I somehow itterate over and over building a single message? |
|
Back to top |
|
 |
bduncan |
Posted: Mon Feb 02, 2004 11:22 am Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
Well, there are a couple of things you can do.
1. Set the buffer length higher than any message will ever be. For instance, if you know that on the putting side the largest a message can be is 3Mb, then set the buffer length to this value.
2. Set the buffer length to MAXMSGLENGTH, which is a per-queue attribute (that can be set), and also a per-queue manager attribute which is platform/version specific. For version 5.0-5.2 you can have up to 100Mb messages, whereas in 5.3 it goes up to 2Gb. Of course, setting the buffer length this large will increase the memory usage of your application, and slow down the rate of MQGETs.
3. Instead just getting the message, do an MQGET with BROWSE, which will return the size the of the message in the MQMD. Then, do an MQGET, using the MsgId from the browse (so you get the same message you just browsed) and set the buffer length to the length of the message from the browse. This is very efficient because you only allocate as much buffer space as you need for each message, but you incur some overhead with the browse. _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Feb 02, 2004 11:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
bduncan wrote: |
For version 5.0-5.2 you can have up to 100Mb messages, whereas in 5.3 it goes up to 2Gb. |
No, actually, that's not true. Even in 5.3, a message can only be 100Mb in size.
A queue in 5.3 can hold more than 2GB worth of messages, though, which was not true in earlier versions (for the most part). _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
bduncan |
Posted: Wed Feb 04, 2004 5:04 pm Post subject: |
|
|
Padawan
Joined: 11 Apr 2001 Posts: 1554 Location: Silicon Valley
|
Jeff,
Thanks for the correction. Seeing as how I don't have a queue manager available to check things on, and seeing as how I haven't actually had an MQ-related job for the past two years means I'm bound to forget stuff
Luckily running this site prevents me from getting too rusty. Who knows I might need this stuff again someday! _________________ Brandon Duncan
IBM Certified MQSeries Specialist
MQSeries.net forum moderator |
|
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
|
|
|
|