I am trying to configure WSO2 to consume messages from ActiveMQ and ask when an error occurs during processing - usually when the failure of the remote web service call 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 transport.jms.SessionTransacted property set to true.
The Jumb roll-back / redelivery / [redirection to dead letter] functions work as expected when the remote URL format is invalid (for example, using the wrong protocol). However, if I stop the remote web server or using the invlaid server name, the message is not requested, although the error is handled by the JMSErrorHandling sequence.
Here is an excerpt from the magazine
[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 makes an asynchronous HTTP call and the JMS transaction is executed before the request completes with an error. Can this behavior be customized?
If additional processing is required - i.e. remote service call chains - how can I ensure that a JMS transaction remains open in sequence so that it can be canceled if an error occurs at a later stage?
Finally, if the WSO2 service is turned off during processing, the message is not requested. Is there an alternative to the configuration proposed here: http://docs.wso2.org/wiki/display/ESB460/JMS+FAQ#JMSFAQ-Howtopreventmessagelossduetounavailabilityofadatasource
Guillaume