Recently I wanted to use the redelivery mechanism available in Apache ActiveMQ while using it with WSO2 ESB. My scenario was like this.
I will explain some of the above parameters.
You will also need to set the SET_ROLLBACK_ONLY property in the fault sequence of your proxy service. Otherwise the transaction will not get rollbacked.
Following links will provide further help.
1. WSO2 ESB documentation's JMS transport section
2. ActiveMQ redeliverPolicy configuration parameters
- Retrieve a message from a JMS queue
- Write the message to a file URI (in your case you may want to send it to a given endpoint)
- If writing to the file is not successful due to some failure, I wanted the message to be in the queue and ActiveMQ to try repeatedly writing to the file.
<parameter name="transport.Transactionality" locked="true">jta</parameter> <parameter name="transport.jms.SessionTransacted" locked="true">true</parameter> <parameter name="redeliveryPolicy.maximumRedeliveries" locked="true">-1</parameter> <parameter name="redeliveryPolicy.redeliveryDelay" locked="true">2000</parameter> <parameter name="transport.jms.CacheLevel" locked="true">consumer</parameter>
I will explain some of the above parameters.
- transport.Transactionality - This is the desired mode of transactionality. I was using distributed transactions. Therefore the value was jta. If you are using local transactions you can put it as local.
- transport.jms.SessionTransacted - Whether the JMS session should be transacted or not.
- redeliveryPolicy.maximumRedeliveries - Maximum number of retries you wish. If set to -1, ActiveMQ will infinitely retry.
- redeliveryPolicy.redeliveryDelay - Delay between retries. I have set it to 2 seconds (i.e. 2000 milliseconds).
- transport.jms.CacheLevel - This is the most important property to get the redelivery mechanism to work properly. This has to be set to "consumer". Reason for this is ActiveMQ RedeliveryPolicy is dictated by CONSUMER, not PRODUCER.
You will also need to set the SET_ROLLBACK_ONLY property in the fault sequence of your proxy service. Otherwise the transaction will not get rollbacked.
<property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
Following links will provide further help.
1. WSO2 ESB documentation's JMS transport section
2. ActiveMQ redeliverPolicy configuration parameters