Duplicate message detection ensures that no message is delivered twice in a HA environment and is performed on the router side for inbound messages (producers) and on the client side for outbound messages (consumers). The base for duplicate message detection is the JMS message ID, which is automatically generated from the producer during send. Since the generation of JMS message IDs can be disabled in the connection factory, it must be enabled (default), otherwise duplicate message detection will not work.
Each queue and each queue controller contains additional attributes for duplicate message detection:
Attribute "Duplicate Detection Enabled" enables or disables duplicate message detection. This attribute is enabled per default in the SwiftMQ HA Router. Attribute "Duplicate Detection Backlog Size" contains the number of JMS message IDs that are held in a backlog. Each new message is checked against this backlog and if the JMS message ID is already stored, the message is considered duplicate and discarded. The size of the backlog on the number of concurrent producers and the number of messages produced while a particular producer is disconnected. Default size is 2000 but it can be increased to a much higher value because the backlog contains only JMS message IDs.
There is another attribute "Log Duplicate Message" at the top level of the Queue Manager Swiftlet. It is disabled by default. If this attribute is enabled, discarded duplicate messages are logged in the warning log file.
JMS message IDs are asynchronously replicated to the STANDBY HA instance.
Outbound duplicate message detection (message delivery from router to JMS client) is performed at the client side on a JMS connection level. The configuration takes place in the connection factory:
Attribute "Duplicate Message Detection" enables or disabled it. This attribute is enabled per default in the SwiftMQ HA Router. Attribute "Duplicate Backlog Size" contains the number of JMS message IDs that are held in a backlog per JMS connection. Before a message is handed over to the JMS client (via receive/onMessage), its JMS message ID is checked against this backlog. If the JMS message ID is already stored, the message is considered duplicate and discarded. The size of this backlog corresponds to the number of message consumers and their smqp-consumer-cache-size. If you have 10 message consumers and a cache size of 500, the backlog must be at least 5000. The default size is 30'000.