【发布时间】:2015-07-02 22:31:32
【问题描述】:
我正在尝试向 WebSphere MQ 发送带有 replyTo 属性的消息。
@SpringBootApplication
public class WmqSenderApplication {
public static void main(String[] args) {
ConfigurableApplicationContext ctx = SpringApplication.run(WmqSenderApplication.class, args);
JmsTemplate jmsTemplate = ctx.getBean(JmsTemplate.class);
jmsTemplate.send("TEST_QUEUE",new MessageCreator() {
@Override
public Message createMessage(Session session) throws JMSException {
TextMessage message = session.createTextMessage();
message.setJMSReplyTo(new MQDestination("REPLY_QUEUE"));//com.ibm.mq.jms.MQDestination
return message;
}
});
}
@Bean
public MQQueueConnectionFactory connFac() throws JMSException {
MQQueueConnectionFactory cf = new MQQueueConnectionFactory();
cf.setTransportType(1);
cf.setHostName("localhost");
cf.setPort(1417);
cf.setQueueManager("TEST");
cf.setChannel("CHANNEL");
return cf;
}
@Bean
public JmsTemplate jmsTemplate() throws JMSException {
return new JmsTemplate(connFac());
}
}
但我得到了:
com.ibm.msg.client.jms.DetailedInvalidDestinationException:
JMSCMQ0005: The destination name '://REPLY_QUEUE' was not valid. The destination name specified does not conform to published destination syntax. Correct the specified destination name and try again.
我在代理中创建了 REPLY_QUEUE 和 TEST_QUEUE。
【问题讨论】: