[quoted text, click to view] > Yes, it's working very good.
I beleive in that
[quoted text, click to view] > Your link is not working.
It's strange. A lot of people can access my site. Anyway....
Please take a look a my code:
---cut---
public static boolean receiveMSMQMessage(String computerName, String
queueName)
{
if ((computerName == null) || (queueName == null)) return false;
try
{
IMSMQQueueInfo qinfo = (IMSMQQueueInfo) new MSMQQueueInfoClass();
String formatName = "DIRECT=OS:" + computerName + queueName;
qinfo.set_FormatName(formatName);
IMSMQQueue pQueue = qinfo.Open ( (int)MQACCESS.MQ_RECEIVE_ACCESS,
(int)MQSHARE.MQ_DENY_NONE );
IMSMQMessage pMsg = null;
for ( ; ;)
{
Variant vtMissing = null;
Object obMissing = (Object) vtMissing;
Variant vtTimeout = new Variant((long)(3));
Object obTimeout = (Object) vtTimeout;
Variant vtWantBody = new Variant((boolean)false);
Object obWantBody = (Object) vtWantBody;
//I don't understand what is happening here - the method always returns
messages with empty body regardless
//obWantBody variable state. But if you try to retrieve these sended
messages using C++ client for example,
//you will get non-empty body!!!
pMsg = pQueue.Receive(obMissing, obMissing, obWantBody, obTimeout);
//-----------------------------------------------------------------------------------------------------
if (pMsg == null)
{
System.out.println("No more messages, closing queue " + formatName);
pQueue.Close();
break;
}
System.out.println("Message was received successfully");
System.out.println("Message label == " + pMsg.get_Label());
System.out.println("Message body length == " + pMsg.get_BodyLength());
System.out.println("Message body == '" + pMsg.get_Body() + "'");
System.out.println("Message CorrelationId == '" +
sBytesToStr(pMsg.get_CorrelationId()) + "'");
System.out.println("Message senderIdType == '" + pMsg.get_SenderIdType()
+ "'");
System.out.println("Removed message from queue " + formatName + "\n");
}
return true;
}
catch (System.Runtime.InteropServices.COMException ex)
{
System.out.println(ex);
}
return false;
}
---cut---
Best wishes,
Dmitry Pakhomenko