Reply-To Queue 在将消息类型作为请求时未在 IBM MQ 中更新
Reply-To Queue is not updating in IBM MQ while putting message type as request
jmsTemplate.sendAndReceive("Queue2", session -> {
TextMessage msg = session.createTextMessage();
msg.setText(message);
msg.setJMSReplyTo(config.getReplyQ()); //Not updated but auto generated queue updated
msg.setJMSCorrelationID("asd_123584_lkj"); //Updated in Destination Queue
msg.setJMSType("MQSTR");
System.out.println("Message : "+msg);
return msg;
});
public Destination getReplyQ() throws JMSException {
MQQueue replyToQ = new MQQueue(queueManager, replyQueue);
Destination replyTo = (Destination) replyToQ;
return replyTo;
}
我读过一些文章说使用 JMS 会更新 RFH 但不会更新 MQMD,而这个 Reply-To Queue 是 MQMD 的一部分,我没有找到正确的 class更新 MQMD header 并将消息发送到 MQ 并更新 reply-to queue.
jmsTemplate.send(config.getQ(), session -> {
TextMessage msg = session.createTextMessage();
msg.setText(message);
msg.setJMSReplyTo(config.getReplyQ());
msg.setJMSCorrelationID("asd_123584_lkj");
System.out.println("Message : " + msg);
return msg;
});
以上方法将设置 JMSReplyTo。
忽略 RFH2 header setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ) 可以像下面这样使用:
public Destination getQ() throws JMSException {
MQQueue replyToQ = new MQQueue(queueManager, queues);
replyToQ.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);
Destination rt = (Destination) replyToQ;
return rt;
}
jmsTemplate.sendAndReceive("Queue2", session -> {
TextMessage msg = session.createTextMessage();
msg.setText(message);
msg.setJMSReplyTo(config.getReplyQ()); //Not updated but auto generated queue updated
msg.setJMSCorrelationID("asd_123584_lkj"); //Updated in Destination Queue
msg.setJMSType("MQSTR");
System.out.println("Message : "+msg);
return msg;
});
public Destination getReplyQ() throws JMSException {
MQQueue replyToQ = new MQQueue(queueManager, replyQueue);
Destination replyTo = (Destination) replyToQ;
return replyTo;
}
我读过一些文章说使用 JMS 会更新 RFH 但不会更新 MQMD,而这个 Reply-To Queue 是 MQMD 的一部分,我没有找到正确的 class更新 MQMD header 并将消息发送到 MQ 并更新 reply-to queue.
jmsTemplate.send(config.getQ(), session -> {
TextMessage msg = session.createTextMessage();
msg.setText(message);
msg.setJMSReplyTo(config.getReplyQ());
msg.setJMSCorrelationID("asd_123584_lkj");
System.out.println("Message : " + msg);
return msg;
});
以上方法将设置 JMSReplyTo。
忽略 RFH2 header setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ) 可以像下面这样使用:
public Destination getQ() throws JMSException {
MQQueue replyToQ = new MQQueue(queueManager, queues);
replyToQ.setTargetClient(WMQConstants.WMQ_CLIENT_NONJMS_MQ);
Destination rt = (Destination) replyToQ;
return rt;
}