Message delivery

Eclipse Amlen natively supports MQTT and JMS protocols.

There are two things that define how a message is delivered:
Message persistence
The persistence of a message defines whether the message is discarded when the server is restarted. Persistent messages are not discarded when the server is restarted. Nonpersistent messages are discarded when the server is restarted.
Message reliability
The reliability of a message defines how many times the message can be received. The reliability can be at most once, at least once, or exactly once.
The persistence and reliability of a message is set when the message is published. The message is delivered to Eclipse Amlen at that level of persistence and reliability. However, a subscriber can request a different level of persistence and reliability when it creates a subscription. If the persistence and reliability levels are not the same as the levels set by the publisher, the lower level is used to forward the message to the subscriber.

MQTT message delivery

MQTT provides three levels of reliability, which are known as qualities of service (QoS). The reliability of the message determines the persistence of the message.

At most once, QoS 0
QoS 0 is the default mode of transfer.

QoS 0 is the fastest mode of transfer. It is sometimes called fire and forget.

The message is delivered at most once, or it is not delivered at all. Its delivery across the network is not acknowledged.

QoS 0 messages are not persistent. The message is not stored on the Eclipse Amlen server. The message might be lost if the publisher is disconnected, or if the server fails. If a subscriber is disconnected at the time the server receives the published message, the subscriber might not receive the message.

At least once, QoS 1
The message is delivered at least once. Duplicate messages can be delivered.
If the publisher of the message does not receive an acknowledgment, the publisher resends the message (indicating it is a duplicate) until an acknowledgment is received. As a result, the subscriber can receive the same message multiple times.

QoS 1 messages are persistent. The message is stored on the Eclipse Amlen server until the message is sent to all the subscribers of the message. If the message subscriber requested a QoS that requires an acknowledgment, the message is stored until the acknowledgment is received.

Exactly once, QoS 2
The message is delivered exactly once. Duplicate messages are not delivered.

QoS 2 is the safest, but slowest mode of transfer.

QoS 2 messages are persistent. The message is stored on the Eclipse Amlen server until it is sent to all the subscribers of the message. If the message subscriber requested a QoS that requires an acknowledgment, the message is stored until the acknowledgment is received.

For more information about how the qualities of service are implemented, see the MQTT V3.1 Protocol Specification.

JMS message delivery

JMS provides two levels of persistence for delivering messages. The reliability of the message is determined by the persistence of the message, and by the acknowledgment mode. An acknowledgment is the term that is used when a JMS send gets a synchronous reply from the server.

Eclipse Amlen supports these standard JMS reliability modes:
At most once, nonpersistent
A JMS message is delivered at most once if it is a nonpersistent message (sent with JMSDeliveryMode set to NON_PERSISTENT).
This type of publication is faster but less reliable than persistent message delivery.
The message is not stored on the Eclipse Amlen server. The message might be lost if the publisher is disconnected, or if the server fails. If a subscriber is disconnected at the time the server receives the published message, the subscriber might not receive the message.
Exactly once, persistent
A JMS message is delivered exactly once if it is a persistent message (sent with JMSDeliveryMode set to PERSISTENT).
This type of publication is most reliable. The message is stored on the Eclipse Amlen server until it is sent to all the subscribers of the message. The message is stored until acknowledgment is received from each subscriber.
In addition to standard JMS reliability modes, Eclipse Amlen supports the following extension:
Fire and forget with DisableACK
Eclipse Amlen allows for JMS message acknowledgment to be disabled with use of the DisableACK ConnectionFactory property.
This type of publication is the fastest but it is also the least reliable. Use it only when occasional message loss can be tolerated.
For fastest transmission, use DisableACK with nonpersistent messages. The message is not stored on the Eclipse Amlen server. The message might be lost if the publisher is disconnected, if the server fails, or because of temporary network issues.
The DisableACK setting applies to messages that are received from the server and to messages that are sent to the server.

Message delivery from JMS to MQTT

When messages are sent from JMS applications to MQTT applications, the JMS reliability and persistence map to MQTT quality of service (QoS) levels. For fastest but least reliable messaging between JMS and MQTT, send nonpersistent JMS messages with the Eclipse Amlen DisableACK property set to true. This configuration provides QoS 0 for MQTT subscriber applications. For the best reliability but slowest messaging rates, send persistent JMS messages and use per-message acknowledgment. This configuration provides up to QoS 2 for MQTT subscribers. The following table shows the possible combinations:

Table 1. Mapping of JMS to MQTT messages

This table describes the mapping of JMS and MQTT messages, outlining the reliability and persistence of the messages sent.

JMS message type sent QoS of matching MQTT subscription Reliability of delivered message Persistence of delivered message
Either nonpersistent or persistent QoS 0 At most once (QoS 0) Nonpersistent
Nonpersistent, acknowledgments turned off QoS 1 At most once (QoS 0) Nonpersistent
Nonpersistent QoS 1 At least once (QoS 1) Nonpersistent
Persistent QoS 1 At least once (QoS 1) Persistent
Nonpersistent, acknowledgments turned off QoS 2 At most once (QoS 0) Nonpersistent
Nonpersistent QoS 2 At least once (QoS 1) Nonpersistent
Persistent QoS 2 Exactly once (QoS 2) Persistent