* Definition
- The Java Message Service (JMS) API,用來訪問消息收發系統,類似於JDBC(Java Database Connectivity)角色,只是是功能是訊息的傳遞。
- A Java Message Oriented Middleware (MOM) API for sending messages between two or more clients.
- A messaging standard that allows application components based on the Java Enterprise Edition (JEE) to create, send, receive, and read messages.
- 是由Sun與MOM廠商所共同制定的介面,定義了訊息的傳送、接收、頻道(Channel)、主題(Topic)、佇列(Queue)等標準介面。
- 實作部份由廠商完成,Java開發人員只要學習標準API介面的使用,就可以利用各廠商的JMS支援系統來進行訊息傳送、接收等處理(您可以想像JDBC與資料庫廠商之間的關係)。
- ex: 包括 IBM 的 MQSeries、BEA的 Weblogic JMS service和 Progress 的 SonicMQ。
* Advantages
Allows the communication between different components of a distributed application to be loosely coupled, reliable, and asynchronous.
* API
- 頻道是用Destination這個介面來定義。
- 在訊息(Message)觀念中提及,訊息服務有兩種模式:
- 出版-訂閱(Publish-Subscribe)
- 點對點(Point-to-Point)
- 頻道分為:
- 主題
- 佇列
- Destination有兩個子介面Topic與Queue來分別代表。
- 根據兩種模式的不同,ConnectionFactory有TopicConnectionFactory、QueueConnectionFactory兩個子介面。
- 對於訊息產生者、訊息消費者的定義則分別為:
- MessageProducer
- MessageConsumer介面
- 而在兩種模式下,分別有發佈 者(Publisher)、傳送者(Sender),以及訂閱者(Subscriber)、接收者(Receiver)。
* Usage
伺服端必須設定好ConnectionFactory以及Destination,並分別使用一個名稱向JNDI註冊,端點必須使用JNDI名稱查找ConnectionFactory及Destination,JMS端點取得ConnectionFactory,使用其與伺服端建立連線,連線以Connection介面定義。
[Message]
- Messaging is a form of loosely coupled distributed communication, where in this context the term 'communication' can be understood as an exchange of messages between software components.
- Message-oriented technologies attempt to relax tightly coupled communication (such as TCP network sockets, CORBA or RMI) by the introduction of an intermediary component.
- The advantages of messaging include the:
- Ability to integrate heterogeneous platforms.
- Reduce system bottlenecks, increase scalability.
- Respond more quickly to change.
[Message passing]
- A form of communication used in parallel computing, object-oriented programming, and interprocess communication.
- In this model, processes or objects can send and receive messages (comprising zero or more bytes, complex data structures, or even segments of code) to other processes. By waiting for messages, processes can also synchronize.
- Message passing is the paradigm of communication where messages are sent from a sender to one or more recipients. Forms of messages include (remote) method invocation, signals, and data packets.
* Reference
- Java Message Service - Wikipedia, the free encyclopedia
- Message passing - Wikipedia, the free encyclopedia
- 簡介 Java Message Service
- 訊息(Message)觀念
- JMS_百度百科
沒有留言:
張貼留言