OverviewFrom ActiveMQ v4: the choice of a broker performing synchronous or asynchronous dispatch to a consumer has become more configurable. It is now configured as a default value on the connection URI, Connection and ConnectionFactory as well as with being customizable on a per consumer basis via the Destination Options instead previously just being a transport server setting. This makes more sense since you want to do asynchronous message delivery to slower consumers, but synchronous message delivery for faster consumers (to avoid the synchronization and context switching costs of adding another SEDA queue). The downside to using synchronous message delivery is that the producer is more likely to block if there is a slow consumer that he is dispatching messages to. The default setting is Configuring Async Dispatch at the ConnectionFactory Level((ActiveMQConnectionFactory)connectionFactory).setDispatchAsync(false); Configuring Dispatch Async at the Connection LevelConfiguring the Configuring Dispatch Async at the Consumer Level using the Destination URIConfiguring the queue = new ActiveMQQueue("TEST.QUEUE?consumer.dispatchAsync=false"); consumer = session.createConsumer(queue); Disabling Async Dispatch on Broker's Transport ConnectorIt is possible to disable async dispatch on a specific transport connector via the <transportConnector name="openwire" uri="tcp://0.0.0.0:61616" disableAsyncDispatch="true"/>
|