Messaging features
This section gives an overview of terminologies and processes within messaging systems: JMS Provider
- Loosely coupled nature of Messaging Systems
- Reliable Delivery of Messages
- Messaging Domains
- Mode of Consumption of Messages
- Administered Objects
- Sessions
- JMS Message
JMS Provider
In messaging systems, clients connect to message providers. Each message has a specific destination which is maintained by the provider. Functions of client applications include producing messages for specific destinations and receiving messages from specific destinations. The provider is responsible for the routing of messages.
Loosely Coupled Nature of Messaging Systems
Senders and receivers remain anonymous to each other since they connect via the provider. The producer and the consumer of messages require the provider to specify the destination of messages so that the producer can send messages to this destination and the consumer can collect messages from this destination
Reliable Delivery of Messages
The sender and the receiver do not have to be available at the same time. The provider delivers the message when the client becomes available.
Messaging Domains
There are two kinds of messaging domains:
- Point-to-Point (PTP)
- Publish-Subscribe(Pub/Sub)
In PTP domains, messages are sent to a particular destination where they queue. A client application delivers messages from this queue to the destination specified by the provider. Though there can be several messages in the queue, each message is intended for only one destination/receiver. The Pub/Sub domain, on the other hand, allows a message to be distributed to more than one subscriber via the provider.
Both these domains can be deployed by FioranoMQ. In addition, FioranoMQ can handle the unified domains introduced by JMS 1.1.
Mode of Consumption of Messages
A message can be consumed synchronously or asynchronously. In the synchronous mode, the client application requests the next message. The client can receive the message in more than one way.
In the asynchronous mode, the client application identifies a message listener. Whenever a message arrives at the defined destination, the provider delivers the message to the subscriber by invoking the OnMessage method.
Administered Objects
JMS providers can employ different methods of delivering messages. To make JMS clients portable proprietary parts are encapsulated within JMS objects and are created by the message provider's administrator. These objects are stored in JNDI namespace and can be used by clients through JMS interfaces.
There are two types of JMS administered objects:
- ConnectionFactory – is the object used by a client to connect with a provider
- Destination – is the object used by a client to specify the destination from which it is receiving messages and to which it is sending messages.
Sessions
A session is a single-thread context for producing and consuming messages. It can create and serve multiple producers and consumers.
A session can be either transacted or non-transacted. Each session supports a single series of transactions and treats them as a unit. Messages produced and consumed within a transaction become the content of that particular transaction. A commit method indicates that message processing can occur. A rollback method disables the processing of messages. In both cases, a transaction is considered to have been completed. A non-transacted session receives messages in a mode specified by JMS 1.1: This mode could be one of the following modes: AUTO_ACKNOWLEDGE, CLIENT_ACKNOWLEDGE, and DUPS_OK. The DUPS_OK is used in applications where messages delivery can be duplicated.
JMS Message
A JMS message consists of a header property which allows adding an optional header field in a message and a body. There are five kinds of messages: StreamMessage, MapMessage, TextMessage, BytesMessage, and ObjectMessage. FioranoMQ extends the TextMessage by providing an additional message type: XMLMessage.
Go through the below sections to dive deep into the subject.