1
我正在通過一個非常簡單的實驗來學習Spring Integration。我在ActiveMQ中設置了兩個隊列,分別是requestQueue和responseQueue。我想要做的是將一條消息發送到requestQueue,然後應用程序將拾取並回顯到responseQueue。這裏是integration.xmlSpring和ActiveMQ在響應消息中缺少關聯ID
<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。我試圖給入站網關的關聯關鍵屬性賦予不同的價值,但沒有成功。有沒有問題或入境網關不應該在第一個地方使用?
另外'響應channel'爲等待答覆爲網關。 JMS回覆(因此相關)稍後完成 –