【发布时间】:2012-06-02 10:58:01
【问题描述】:
我有一个 web 应用程序,它预计会从只能通过消息传递 (JMS) 访问的外部应用程序获取和显示数据。
因此,如果用户在浏览器上提交请求,同一个 HTTP 请求线程必须与消息系统(MQ 系列)交互,以便同一个请求线程可以显示从消息系统接收到的数据。
我可以在这里使用一种模式吗?我在网上看到一些以这种方式使用“Correlation ID”的模糊参考:
Msg m = new TextMsg("findDataXYZ");
String cr_id = m.setCorrelationID(id);
sendQueue.send(m).
// now start listening to the Queue for a msg that bears that specific cr_id
Response r = receiverQueue.receive(cr_id);
那里有更好的东西吗?我发现的其他模式期望异步接收响应。这对我来说不是一个选项,因为我必须在同一个 HTTP 请求上发回响应。
【问题讨论】:
标签: java architecture jms ibm-mq