How to get the response from REPLY QUEUE with correlation ID received from request?
Hi,
I am using the below code to send message
Code:
public String sendMessage(final String text) {
System.out.println("requestQueue: "+requestQueue);
MyMessageCreator messageCreator =
new MyMessageCreator(text);
String correlationId = null;
try
{
jmsTemplate.send("REQ.INQ.01", messageCreator);
correlationId = messageCreator.message.getJMSMessageID();
}
catch(Exception e)
{
System.out.println("Exception has Occured");
}
System.out.println("correlationId"+correlationId);
return correlationId;
}
Below code to receive message
Code:
public String readMessage() throws JMSException {
String message = null;
String resSelectorId = "JMSCorrelationID = '"+correlationId+"'";
System.out.println("responseQueue: "+responseQueue);
//Message msg = jmsTemplate.receive("RPL.INQ.01");
Message msg = jmsTemplate.receiveSelected("RPL.INQ.01",resSelectorId);
}
It fails when I use jmsTemplate.receiveSelected("RPL.INQ.01",resSelect orId); ....There is no response received.
Application returns ByteMessages with all Junk characters when I use
Message msg = jmsTemplate.receive("RPL.INQ.01");
Junk is too length..I am pasting the message which chracters it starts with..
LÔ¢‡nLÔ¢‡È…?„…™nLÔ¢‡Õ–nðððððððñLaÔ¢‡Õ–nLâ–¤™ƒ…nòðñ Laâ–¤™ƒ…nLÔ¢‡Ù…†Õ–nÉåñòðñóðñóñðððððððñòLaÔ¢‡Ù…†Õ–n LÓ–‡–•ÉÄn@@@@@@@@LaÓ–‡–•ÉÄnL×ÁÕn@@@@@@@@@@@@@@@@La ×ÁÕnLã§•Ã
I wanted to make it synchrounous and get the response..Please advice to resolve the issue.
I could put the message and get the message ID for request from MQ as well...
Also I could see correct response received on the MQ explorer but I get junk characters in program response.
Thanks