Setting Message Properties

Nov 8, 2009 at 10:07 PM

Is there a way to set a Message's properties?

Also, I could not feagure what collationId means.

Jan 19, 2010 at 4:39 PM

Don't know about the options to set Message's properties in MsmqJava.

But correlation ID allows one to give an "external id" to the MSMQ message. This can be useful if sending a request-message, and expect to get a reply-message, then by using the correlation ID it is possible to match the reply with the original request-message. It requires that the receiver of the request-message puts the correlation ID on the reply-message.

Mar 28, 2010 at 10:11 PM

The typical way to use MsmqJava is this:

  try {
      String label="testmessage";
      String body= "....";
      byte[] correlationId = { 2,3,4,5,5,6,6,7,8,9,0}; // up to 20 bytes
      Message msg= new Message(body, label, correlationId);
  catch (MessageQueueException ex1) {
       System.out.println("Put failure: " + ex1.toString());