Binding a channel to JMS is similar to binding a reference or service. The main difference is that by default, Topics instead of Queues are used for messaging:
<channel name="TestDurableChannel" requires="f3:durable"> <binding.jms> <destination jndiName="TestDurableChannelTopic"/> </binding.jms> </channel>
NLost Messages
When a channel is bound to a JMS Topic, there is the possibility the events sent to the channel will be dropped and not received by consumers. To understand why this happens it is necessary to describe how consumers are attached to the JMS channel binding. Fabric3 implements a message container that performs a looping blocking receive with a timeout. This is necessary to support transactional dequeue (the receive is performed within a transaction) and also to avoid tying up kernel threads indefinitely. If a timeout occurs, the container will loop and perform another receive. If a message is received, it will be processed and the container will loop and perform a new receive. This creates the possibility of a window where no consumers are connected to the Topic. When this occurs, a JMS provider is free to drop messages. At high message rates, the possibility of dropping messages increases as the message container will frequently be processing messages and not receiving.
To avoid dropped messages, the channel should be configured as durable. This will result in a JMS durable topic subscription being used. However, using durable subscriptions comes at a significant cost both in terms of performance and memory requirements as messages must be held in a topic until they have been delivered to all active subscriptions.
Add Comment