Author |
Message
|
gleeuw |
Posted: Fri Aug 07, 2009 1:14 am Post subject: MQGet does not return immediately if messaga is available |
|
|
Newbie
Joined: 07 Aug 2009 Posts: 3
|
To get MQ messages i am using dotnet amqmdnet assembly, version 1.0.0.3
The method Get(IBM.WMQ.MQMessage message, IBM.WMQ.MQGetMessageOptions gmo)
with messageoptions MQC.MQGMO_WAIT and messageOptions.WaitInterval= 10000 will always wait for 10 seconds, in all cases, whether messages are available before the call is made, after the call, and when no messages are available (expected behavior). I'd expect the call to return immedialy when messages are or become available. Could this be caused by Queue settings at the server side? Client is running on windows XP (MQ client version 5.3) server is running on windows server 2003.
Thanks,
Gerard. |
|
Back to top |
|
 |
WMBDEV1 |
Posted: Fri Aug 07, 2009 1:24 am Post subject: Re: MQGet does not return immediately if messaga is availabl |
|
|
Sentinel
Joined: 05 Mar 2009 Posts: 888 Location: UK
|
gleeuw wrote: |
Could this be caused by Queue settings at the server side? |
No.
Please show us the rest of the code (specifically how your message object and GMO objects are built / populated). |
|
Back to top |
|
 |
zpat |
Posted: Fri Aug 07, 2009 1:24 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
MQGET with WAIT will end immediately that a message that meets the criteria for selection is available.
Thousands of sites rely on this logic - it will do this. |
|
Back to top |
|
 |
gleeuw |
Posted: Fri Aug 07, 2009 2:30 am Post subject: Re: MQGet does not return immediately if messaga is availabl |
|
|
Newbie
Joined: 07 Aug 2009 Posts: 3
|
WMBDEV1 wrote: |
gleeuw wrote: |
Could this be caused by Queue settings at the server side? |
No.
Please show us the rest of the code (specifically how your message object and GMO objects are built / populated). |
That's clear, OK:
// code to receive messages:
MQQueueManager queueManager = new MQQueueManager(Settings.ManagerName, Settings.Channel, Settings.HostName);
MQQueue queue = queueManager.AccessQueue(Settings.QueueName,
MQC.MQOO_INPUT_AS_Q_DEF + // open queue for input
MQC.MQOO_FAIL_IF_QUIESCING); // but not if MQM stopping
string result = string.Empty;
MQGetMessageOptions MessageOptions new MQGetMessageOptions();
messageOptions.Options |= MQC.MQGMO_WAIT;
messageOptions.WaitInterval = 10000;
MQMessage message = new MQMessage();
if (Queue.IsOpen)
{
Queue.Get(message, MessageOptions);
if (message.Format.CompareTo(MQC.MQFMT_STRING) == 0)
{
result = message.ReadString(message.MessageLength);
}
else
{
string msg = MQResources.MQManagerMessageNotString + Environment.NewLine + message;
Logger.WriteWarning(msg);
}
}
// code to send messages
// MQOO_OUTPUT = Open queue to put messages.
// The queue is opened for use with subsequent MQPUT calls.
Queue = QueueManager.AccessQueue(
Settings.QueueName,
MQC.MQOO_OUTPUT + // open queue for output
MQC.MQOO_FAIL_IF_QUIESCING); // but not if MQM stopping
try
{
foreach (string bericht in berichten)
{
MQMessage message = new MQMessage(); // MQMessage instance
message.Format = MQC.MQFMT_STRING;
message.CharacterSet = MQCharacterSet;
message.WriteString(bericht);
Queue.Put(message);
}
}
finally
{
Queue.Close();
}
When sending messages to the queue (from another process), the receiving part waits for WaitInterval to have past, then returning the messages OK.
Thank you for the prompt response, and thanks again in advance. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Aug 07, 2009 3:36 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Quote: |
Client is running on windows XP (MQ client version 5.3) server is running on windows server 2003. |
Ok so you're running on software where the .NET stuff was introduced with (did not specify the CSD) that is no longer supported and you expect this to work flawlessly?
The answer is EASY: Get on supported software like MQ Client 6.0.2.7 or 7.xxx (see latest version on IBM site)  _________________ MQ & Broker admin |
|
Back to top |
|
 |
gleeuw |
Posted: Fri Aug 07, 2009 5:41 am Post subject: |
|
|
Newbie
Joined: 07 Aug 2009 Posts: 3
|
fjb_saper wrote: |
Quote: |
Client is running on windows XP (MQ client version 5.3) server is running on windows server 2003. |
Ok so you're running on software where the .NET stuff was introduced with (did not specify the CSD) that is no longer supported and you expect this to work flawlessly?
The answer is EASY: Get on supported software like MQ Client 6.0.2.7 or 7.xxx (see latest version on IBM site)  |
This seems to work. Perhaps a problem in the former installation. Thanks. |
|
Back to top |
|
 |
|