Spring ActiveMQ message retransmission mechanism

"Realization of Retransmission Mechanism"

<bean id="activeMQRedeliveryPolicy" class="org.apache.activemq.RedeliveryPolicy">

<!--Whether to increase this waiting time after each unsuccessful attempt to resend-->

<property name="useExponentialBackOff" value="true"></property>

<!--The number of retransmissions, the default is 6 times here is set to 1 time -->

<property name="maximumRedeliveries" value="1"></property>

<!--Resend time interval, the default is 1 second-->

<property name="initialRedeliveryDelay" value="1000"></property>

<!--Wait 500 milliseconds before resending after the first failure, wait 500 * 2 milliseconds for the second failure, where 2 is value -->

<property name="backOffMultiplier" value="2"></property>

<!--Maximum transmission delay, only valid when useExponentialBackOff is true (V5.5), assuming that the first reconnection interval is 10ms and the multiple is 2, then the first reconnection interval is 10ms. 

The second reconnection time interval is 20ms, and the third reconnection time interval is 40ms. When the reconnection time interval is larger than the maximum reconnection time interval, each subsequent reconnection time interval is the maximum reconnection time interval. -->

<property name="maximumRedeliveryDelay" value="1000"></property>

</bean>

 

<!--Configure the retransmission mechanism at the connection factory-->

<bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">

<property name="brokerURL" value="tcp://localhost:61616"></property>

<property name="redeliveryPolicy" ref="activeMQRedeliveryPolicy" /> <!-- Reference retransmission mechanism-->

</bean>

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326026749&siteId=291194637