all groups > vj# > december 2004 >
You're in the

vj#

group:

MS-MQ and J#


MS-MQ and J# Dmitry Pakhomenko
12/14/2004 11:51:02 PM
vj#:
Hello, everybody!
Does anyone have an experience of using MS-MQ messaging system under j#?
I have a trouble - I can't get message body, I always receive messages which
have bodylength==0. I'm using MS-MQ functionality which is accessible after
mqoa.dll reference addition. According MS description IMSMQQueue.Receive()
has four parameters, the third is so-called "WantBody", but I get messages
without bodies regardless of this parameter state. And moreover, I can get
messages with filled bodyes, which were sended by my j# example and were
retrieved by C++ client, not j#!
You can see my sources at http://magictale.com/download/MS_MQ-JS.zip

Thank you very much.
Re: MS-MQ and J# David Browne
12/15/2004 9:46:04 PM

"Dmitry Pakhomenko" <Dmitry Pakhomenko@discussions.microsoft.com> wrote in
message news:D38B1FFF-E3DD-462B-A2C5-5DFE1D725FA3@microsoft.com...
[quoted text, click to view]


Ahh, You are trying to use the MSMQ COM library.

Ditch that old thing and use the System.Messaging

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemmessagingmessageclasstopic.asp


David

Re: MS-MQ and J# Lars-Inge Tønnessen [VJ# MVP]
12/15/2004 11:11:25 PM

[quoted text, click to view]
messaging system under j#?


Yes, it's working very good.



[quoted text, click to view]


Your link is not working.

Do you have any code we can take a look at. Please post a small sample of
what you are trying to do here in plain text.



Regards,
Lars-Inge Tønnessen

Re: MS-MQ and J# Pakhomenko Dmitry
12/16/2004 8:42:15 AM
[quoted text, click to view]
I beleive in that

[quoted text, click to view]
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

Re: MS-MQ and J# Pakhomenko Dmitry
12/16/2004 10:42:28 AM
[quoted text, click to view]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemmessagingmessageclasstopic.asp

O-h....
There is one more path to access to MSMQ
Thank you very much, David.

Best wishes, Dmitry
Dmitry

Re: MS-MQ and J# Lars-Inge Tønnessen [VJ# MVP]
12/16/2004 7:50:12 PM

Please use the .net API. Here is one of my previous reply on using the MSMQ
with J#.

http://www.eggheadcafe.com/ng/microsoft.public.dotnet.vjsharp/post524418.asp


Regards,
Lars-Inge Tønnessen

AddThis Social Bookmark Button