I am trying to configure WSO2 to consume message from ActiveMQ, and requeue when an error is raised during processing - typically when the call to the remote web service fails.
<proxy name="SimpleStockQuoteService" transports="jms" startOnLoad="true">
<target>
<inSequence onError="JSMErrorHandling">
<log level="full"/>
<send>
<endpoint>
<address uri="http://localhost/testapp"/>
</endpoint>
</send>
<log level="full"/>
<log level="custom">
<property name="Custom log" value="End In Sequence"/>
</log>
</inSequence>
<outSequence>
...
</outSequence>
</target>
</proxy>
<sequence name="JSMErrorHandling">
<log level="custom">
<property name="Error" value="Error executing sequence"/>
</log>
<property name="SET_ROLLBACK_ONLY" value="true" scope="axis2"/>
<drop/>
</sequence>
Activemq is configured in axis2.xml with the property transport.jms.SessionTransacted set to true.
The JMS roll-back/redelivery/[redirection to dead letter] features work as expected when the format of remote URL is invalid (for instance using wrong protocol). However if I stop the remote web server, or using invlaid server name, the message is not requeued, although the error is handled by JMSErrorHandling sequence.
Here is a excerpt from the log
[2013-06-04 12:17:47,810] INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:GCHESNEL764-57101-1370344525419-9:1:1:1:1, Direction: request, Envelope: <?xml ver
[2013-06-04 12:17:47,813] INFO - LogMediator To: , WSAction: urn:mediate, SOAPAction: urn:mediate, MessageID: ID:GCHESNEL764-57101-1370344525419-9:1:1:1:1, Direction: request, Envelope: <?xml ver
[2013-06-04 12:17:47,814] INFO - LogMediator Custom log = End In Sequence
[2013-06-04 12:17:48,818] WARN - ConnectCallback Connection refused or failed for : localhost/127.0.0.1:80
[2013-06-04 12:17:48,821] WARN - EndpointContext Endpoint : endpoint_413907dd1d4e2370ea0ae277fbfebcaf6504f196a11459bb will be marked SUSPENDED as it failed
[2013-06-04 12:17:48,823] WARN - EndpointContext Suspending endpoint : endpoint_413907dd1d4e2370ea0ae277fbfebcaf6504f196a11459bb - current suspend duration is : 30000ms - Next retry after : Tue J
[2013-06-04 12:17:48,824] INFO - LogMediator Error = Error executing sequence
It looks like WSO2 is making the HTTP call asynchronously and the JMS transaction is committed before the request is fails. Can this behavior be configured?
If further processing is required - i.e. chaining remote service calls - how do I insure that the JMS transaction is left open in out sequence, so it can be rolled back if an error occurs at later stage?
Finally if WSO2 service is shutdown during processing, the message is not requeued. Is there an alternative to the configuration proposed here: http://docs.wso2.org/wiki/display/ESB460/JMS+FAQ#JMSFAQ-Howtopreventmessagelossduetounavailabilityofadatasource
Guillaume