JMS Specification Essentials __JMS

Source: Internet
Author: User
I. Overview

JMS (Java Message Service, Java Messaging Services) JMS clients can communicate asynchronously through the JMS service

second, the message model#p2p (point to point):
1. Elements: Message queues, senders, receivers, each message is sent to a specific queue, the receiver gets the message from the queue, and the queue retains the message until it is consumed or timed out
2, Characteristics: Each message only a consumer, sender and receiver no time dependence (synchronization), recipient to receive success needs to reply to the queue success
#pub/sub (Publish subscription mode)
1. Elements: Subject (Topic), publisher (publisher), subscriber
2. Features: Each message can have a time dependency between multiple consumers, publishers, and subscribers. For a subscriber to a topic, it must be created before the Subscriber can consume the publish message
third, the consumption of information#JMS中消息的生产和消费是异步的. For consumers, JMS consumers can consume messages in two ways
1. Synchronization: The Subscriber or receiver invokes the Receive method to receive messages, which are blocked until they can receive messages
2, asynchronous: Subscribers or receivers can be registered as a message listener. When the message arrives, the system automatically invokes the OnMessage method of the listener
Four, the JMS programming model#ConnectionFactory
The factory that created the connection object, for two different message models, has queueconnectionfactory and topicconnectionfactory
#Connection
Represents a connection between a client and a JMS system. Connection can produce one or more sessions
#Session session-is the thread that receives or sends messages
A session is an interface for manipulating messages to create a message source (destination) or a producer, consumer
#Destination
Message Source: A queue that is point-to-point or a topic for publishing subscriptions (topic)
#MessageProducer
The message producer is created by the session and sends the message to the message source (destination), calling the Send method to send a message
#MessageSonsumer
Message consumers are created by session, receive messages from message sources (destination), call the Receive method to get message objects
#MesssgeListener
Message listener: If a message listener is registered, the listener's Onmessgae method is automatically invoked once the message arrives

v. Summary The JMS specification is a base-level implementation model for many message middleware such as ACTIVEMQ, Metaq, and Kestrel, and the Distributed service Framework, Kafka, is also based on the JMS specification, and their common feature is to provide a point-to-point or asynchronous invocation service such as a subscription.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.