JMS技术在j2ee项目中的企业集成模式(enterprise integration pattern)分析文章
说明:本系列文章是学习谷歌的架构师Gregor Hohpe 与人合著的《企业集成模式(Enterprise Integration Patterns)》一书的翻译及解释和针对本人工作遇到的相关问题的思考。
参考网站:[url]www.enterpriseintegrationpatterns.com [/url]
前言(preface)
本书是一本关于用消息机制的技术进行企业应用集成的书。它不是特定的技术和产品的技术文档,相反,它关注于帮助开发者和系统集成人员理解相关产品和技术,比如(以下具体产品和技术不翻译,真搞技术的人你懂的):
* Message-oriented middleware (MOM) and integration suites offered by vendors such as the IBM (WebSphere MQ Family), Microsoft (BizTalk), TIBCO, WebMethods, SeeBeyond, Vitria, and others * Java Message Service (JMS) implementations incorporated into commercial and open-source J2EE application servers as well as standalone products
* Microsoft’s Message Queuing (MSMQ), accessible through several API’s, including the System.Messaging libraries in Microsoft .NET
* Emerging Web services standards that support asynchronous Web services (for example, WS-ReliableMessaging) and the associated API’s such as Sun’s Java API for XML Messaging (JAXM) or Microsoft’s Web Services Extensions (WSE).
介绍企业集成:
Enterprise integration goes beyond creating a single application with a distributed n-tier architecture, which enables a single application to be distributed across several computers. Whereas one tier in a distributed application cannot run by itself, integrated applications are independent programs that can each run by itself, yet that function by coordinating with each other in a loosely coupled way. Messaging enables data or commands to be sent across the network using a “send and forget” approach where the caller sends the information and then goes on to other work while the information is transmitted by the messaging system. Optionally, the caller can later be notified of the result through a callback. Asynchronous calls and callbacks can make a design more complex than a synchronous approach, but an asynchronous call can be retried until it succeeds, which makes the communication much more reliable. Asynchronous messaging also enables several other advantages such as throttling of requests and load balancing.
企业集成不是一种用分层架构来设计单一应用的工作,它是一种让单应用系统能分布运行在多台计算机上。在分布式系统上单一子系统无法单独运行,集成的各子系统不是依靠自己就能独立运行的程序,相反,分布式系统上各子系统依靠一种松耦合的方法来协作运行。消息机制使数据和命令能通过一种“发送和遗忘”的机制来完成跨网络传输。
“发送和遗忘”机制是一种调用者发送消息后就返回到自己的工作,具体工作交由消息系统(相当于领导的秘书,具体会议通知由秘书去做,领导(调用者)只关注结果)处理的机制,以后调用者能通过消息系统回调机制得到发送消息成功与否。
异步调用和回调比同步调用复杂,但是能被消息系统重复执行直到成功,而需要完成消息发送的调用者无需关注此过程,这种机制使通讯更加可靠,同时他也保证了子系统之间的请求减少(这个地方还行斟酌)和负载均衡。