MQ

MQ

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only

XMS.NET - Error while sending the response back to out queue

  • 1.  XMS.NET - Error while sending the response back to out queue

    Posted Thu September 15, 2022 12:21 PM

    *****************************************************************************

    Regarding: "Sending response back to the out/reply queue."

     

    There is a requirement to send the response back to a different queue (reply queue).

    While sending the response, we have to use the correlation and message id from the request message and pass it to the reply queue as header. I suspect the format of correlation/message id is wrong.

     

    While reading the message, the correlation id and message id format are as below:
    MessageId = "ID:616365323063633033343361313165646139306638346264"

    CorrelationId = "ID:36626161303030305f322020202020202020202020202020"

     

     

    While sending the back to out/reply queue, we are passing these ids as below:


    ITextMessage txtReplyMessage = sessionOut.CreateTextMessage();

     

    string[] parms = sentMessage.Name.Split('-');

    txtReplyMessage.JMSMessageID = "616365323063633033343361313165646139306638346264";

    txtReplyMessage.JMSCorrelationID = "36626161303030305f322020202020202020202020202020";

    txtReplyMessage.Text = sentMessage.Contents;

     

     

    txtReplyMessage.JMSDeliveryMode = DeliveryMode.NonPersistent;

    txtReplyMessage.JMSPriority = sentMessage.Priority;

    //  LogWrite("Send before =" + textMessage);

    LogWrite("before sending response =" + txtReplyMessage.Text);

    messagePoducerOut.Send(txtReplyMessage);

     

    Please note:

    1. With the XMS.NET library, we need to pass the correlation and message id in string format as per shown above
    2. With MQ API's (which we were using earlier) passing the correlation and message ids we use to send in bytes format like below:

    MQMessage queueMessage = new MQMessage();

     

                    string[] parms = document.name.Split('-');

                    queueMessage.MessageId = StringToByte(parms[1]);

                    queueMessage.CorrelationId = StringToByte(parms[2]);

                    queueMessage.CharacterSet = 1208;

                    queueMessage.Encoding = MQC.MQENC_NATIVE;

                    queueMessage.Persistence = 0;  // Do not persist the replay message.

                    queueMessage.Format = "MQSTR   ";

                    queueMessage.WriteString(document.contents);

                    queueOut.Put(queueMessage);

                    queueManagerOut.Commit();

     

    Please see if we can help troubleshoot the problem.

     

    *********************************************************************************



    ------------------------------
    Balaji Patil
    ------------------------------