博客已搬家,更好阅读体验,猛戳 http://www.jack-yin.com/english/translation/activemq-in-action/1558.html
7.3 Implementing request/reply with JMS
7.3 使用JMS实现请求/应答程序
As described in earlier chapters, messaging is all about the decoupling of senders from
receivers. Messages are sent by one process to a broker, and messages are received from
a broker by a different process in an asynchronous manner. One style of system architecture
that can be implemented using JMS is known as request/reply. From a high level,
a request/reply scenario involves an application that sends a message (the request)
and expects to receive a message in return (the reply). Traditionally, such a system
design was implemented using a client-server architecture, with the server and the client
communicating in a synchronous manner across a network transport (TCP, UDP,
and so on). This style of architecture certainly has scalability limitations, and it’s difficult
to distribute it further. That’s where messaging enters the picture—to provide the
ability to design a system that can easily scale much further via a messaging-based
request/reply design. Some of the most scalable systems in the world are implemented
using asynchronous processing like that being demonstrated in this example.
通过前面几章我们了解到,消息是用来为其发送者和接收者解耦的.消息通过一个进程发送给代理,然后
代理在另外一个进程异步的接收消息.一种可以利用JMS来实现的系统架构被称为请求/应答.概括的说,
一个请求/应答场景包括一个发送消息(请求)并期望接收消息返回值(应答)的应用程序.通常,这样的系统
被设计成CS架构,服务端和客户端通过网络传输协议(TCP,UDP等等)同步的进行通信.这种架构方式在可
扩展方面具有明显的限制,很难获得长远发展.消息系统正是为此而生--通过基于消息的请求/应答设计
模式能够设计出易于扩展的系统.正如例子中展示的那样,世界上可扩展性最好的系统都是使通过
异步处理方式实现的.
..........