sidan001的博客 JMS2.0 JMS DomainsArchitecture(体系架构) Architecture(体系架构)

文章目录

JMS supports the two major styles of messaging provided by enterprise messaging products:

  • Point-to-point (PTP) messaging allows a client to send a message to another client via an intermediate abstraction called a queue.
    The client that sends the message sends it to a specific queue. The client that receives the message extracts it from that queue.
  • Publish and subscribe (pub/sub) messaging allows a client to send a message to multiple clients via an intermediate abstraction called a topic.
    The client that sends the message publishes it to a specific topic. The message is then delivered to all the clients that are subscribed to that topic.

JMSDomains

Architecture(体系架构)

What is a JMS application?

A JMS application is composed of the following parts:

  • JMS Clients - These are the Java language programs that send and receive messages.
  • Non-JMS Clients - These are clients that use a message system’s native client API
    instead of JMS.If the application predated the availability of JMS it is likely that it will include both JMS and non -JMS clients.
  • Messages - Each application defines a set of messages that are used to communicate information between its clients.
  • JMS Provider - This is a messaging system that implements JMS in addition to the other administrative and control functionality required of a full featured messaging product.
  • Administered Objects - Administered objects are preconfigured JMS objects created by an administrator for the use of clients.

    • ConnectionFactory - This is the object a client uses to create a connection with a provider.
    • Destination - This is the object a client uses to specify the destination of messages it is sending and the source of messages it receives.

    JMS_Administration_Architecture

Interfaces common to multiple APIs

The main interfaces common to multiple APIs are as follows:

  • Message, BytesMessage, MapMessage, ObjectMessage, StreamMessage and TextMessage – a message sent to or received from a JMS provider.
  • Queue – an administered object that encapsulates (封装) the identity of a message destination for point-to-point messaging
  • Topic – an administered object that encapsulates the identity of a message destination for pub/sub messaging.
  • Destination - the common supertype of Queue and Topic

Classic API interfaces

The main interfaces provided by the classic API are as follows:

  • ConnectionFactory - an administered object used by a client to create a Connection. This interface is also used by the simplified API.
  • Connection - an active connection to a JMS provider
  • Session - a single-threaded context for sending and receiving messages
  • MessageProducer - an object created by a Session that is used for sending messages to a queue or topic
  • MessageConsumer - an object created by a Session that is used for receiving messages sent to a queue or topic

    Overview of classic API

Simplified API interfaces

The simplified API provides the same messaging functionality as the classic API but requires fewer interfaces and is simpler to use.

The main interfaces provided by the simplified API are as follows:

  • ConnectionFactory - an administered object used by a client to create a Connection. This interface is also used by the classic API.
  • JMSContext - an active connection to a JMS provider and a single-threaded context for sending and receiving messages
  • JMSProducer - an object created by a JMSContext that is used for sending messages to a queue or topic
  • JMSConsumer - an object created by a JMSContext that is used for receiving messages sent to a queue or topic

    Overview of simplified API

In the simplified API a single JMSContext object encompasses the behaviour which in the classic API is provided by two separate objects, a Connection and a Session. Although this specification refers to the JMSContext as having an underlying “connection” and “session”, the simplified API does not use the Connection and Session interfaces.

A Connection represents a physical link to the JMS server,

a Session represents a single-threaded context for sending and receiving messages,

a JMSContext represents both.

reference Java Message Service (JMS)