《ActiveMQ in Action》的笔记-第34页
- 页码：第34页 2011-10-28 23:51:17
请求回复消息。Request/reply messaging in JMS applications Although the JMS spec doesn’t define request/reply messaging as a formal messaging domain, it does provide some message headers and a couple of convenience classes for handling basic request/reply messaging. Request/reply messaging is an asynchronous back-and-forth conversational pattern utilizing either the PTP domain or the pub/sub domain through a combination of the JMSReplyTo and JMSCorrelationID message headers and temporary destinations. The JMSReplyTo specifies the destination where a reply should be sent, and the JMSCorrelationID in the reply message specifies the JMSMessageID of the request message. These headers are used to link the reply message(s) to the original request message. Temporary destinations are those that are created only for the duration of a connection and can only be consumed from by the connection that created them. These restrictions make temporary destinations useful for request/reply. The convenience classes for handling basic request/reply are the QueueRequestor and the TopicRequestor. These classes provide a request() method that sends a request message and waits for a reply message through the creation of a temporary destination where only one reply per request is expected. These classes are useful only for this most basic form of request/reply, as shown in figure 2.8—one reply per request. Figure 2.8 depicts the basic request/reply style of messaging between two endpoints. This is commonly achieved using the JMSReplyTo message header and a temporary queue where the reply message is sent by the receiver and consumed by the requestor. As stated previously, the QueueRequestor and the TopicRequestor can handle basic request/reply but aren’t designed to handle more complex cases of request/reply, such as a single request and multiple replies from many receivers. Such a sophisticated use case requires you to develop a custom JMS application.
stephansun对本书的所有笔记 · · · · · ·
The purpose of enterprise messaging was to transfer data among disparate systems by sendin...
Message-oriented middleware (MOM) is best described as a category of software for communic...
7.3 Implementing request/reply with JMS As described in earlier chapters, messaging is al...
Using the request/reply pattern, envision that there are thousands of requests entering t...
说明 · · · · · ·