activemq5.1.0支持的异步传输方式
首先说明参考地址:http://activemq.apache.org/async-sends.html在这个官方文档中得知,ActiveMQ 默认在大多数情况下都是按照异步传输的。但是有些情况则不是,比如原文中写道
The cases that we are forced to send in sync mode are when persistent messages are being sent outside of a transaction.
意思是说当我们利用持久发送的模式,而且不利用事务的时候,就会按照同步的方式来发送。
文章中同样提到了利用异步传输,是在“容忍在交互失败时可能存在发生微小的数据丢失的情况下”。
设置异步通信可以应用下面三种方式
1.在在建立链接工厂的url中设置,如:
cf = new ActiveMQConnectionFactory("tcp://locahost:61616?jms.useAsyncSend=true");
2.在连接工厂中设置
((ActiveMQConnectionFactory)connectionFactory).setUseAsyncSend(true);
3.在连接对象上直接设置
((ActiveMQConnection)connection).setUseAsyncSend(true);
页:
[1]