How to make a JMS Synchronous request

后端 未结 2 1890
无人及你
无人及你 2021-02-14 04:52

I have an webapp that is expected to fetch and display data from an External App which is accessible only via messaging (JMS).

So, if a user submits a request on a brows

2条回答
  •  佛祖请我去吃肉
    2021-02-14 05:23

    The request/reply messaging pattern is useful for your requirement. You typically use a CorrelationId to relate request & reply messages.

    While sending request message you set JMSReplyTo destination on the message. Typically a temporary queue is used as JMSReplyTo destination. When creating a consumer to receive response use a selector with JMSCorrelationId, something like

    cons = session.createConsumer(tempDestination,"JMSCorrelationId="+requestMsg.JMSMessageId);

    At the other end, the application that is processing the request message must use the JMSReplyTo destination to send response. It must also use the MessageId of the request message and set it as CorrelationId of the response message.

提交回复
热议问题