【发布时间】:2016-12-20 07:58:34
【问题描述】:
我正在通过一个非常简单的实验来学习 Spring Integration。我在 ActiveMQ 中设置了两个队列,即 requestQueue 和 responseQueue。我想要做的是向 requestQueue 发送一条消息,然后应用程序将接收并回显到 responseQueue。这是integration.xml中的配置
<int:channel id="requestChannel"/>
<int:channel id="responseChannel"/>
<int:service-activator id="echoServiceActivator" input-channel="requestChannel" ref="echoServiceImpl"
requires-reply="true" output-channel="responseChannel"/>
<jms:inbound-gateway request-channel="requestChannel" reply-channel="responseChannel"
connection-factory="jmsConnectionFactory"
request-destination="requestQueue" default-reply-destination="responseQueue"
id="echoGateway" />
还有服务类
@Service
public class EchoServiceImpl implements EchoService {
private static final Logger logger = LoggerFactory.getLogger(EchoServiceImpl.class);
@Override
@ServiceActivator
public String echo(Message<String> message) {
logger.info("Received message: {}", message.getPayload());
return message.getPayload();
}
}
responseQueue 中的内容进展顺利。问题是相关ID永远不会出现。我希望它将包含请求消息的消息 ID。我试图为入站网关的相关键属性设置不同的值,但没有成功。是有什么问题还是一开始就不应该使用入站网关?
【问题讨论】:
标签: java activemq spring-integration