You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Paweł Wesołowski <pa...@softwaremind.pl> on 2010/07/22 15:53:27 UTC

Soap routing flow with specific failover handing

Hi all,

I need to create a camel flow, which will do following things:

    * receive soap messages and routes them to a remote web service
      (this is actually done)
    * when the remote web service is not available messages are stored
      in activemq queue where they wait for the service to be up again
    * when the remote web service becomes reachable messages are polled
      from activemq queue, send to web service and soap responses are
      routed back to clients

Checking if the remote web service is up again can be done by 
periodically polling first message from the queue and trying to send it 
to the web service, if some problems occur during this process this 
means that service is still not available.

The hardest part for me is to react correctly when service goes up 
again. How can I run the flow that instantly polls all messages from 
queue when the first one is delivered without any problems? And even 
harder task for me, how can I route the responses back to proper clients?

I am using camel in version 2.2.0.

Flow routing soap messages:

<camelContext id="test_context" 
xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- generic cxf endpoint - receives every soap message -->
<from 
uri="cxf://http://localhost:9000/soaprouter?serviceClass=SOAPMessageProvider" 
/>

<bean ref="soapMesssageToStream" /> <!-- converts SOAPMessage to stream -->

<setHeader 
headerName="CamelHttpMethod"><constant>POST</constant></setHeader>
<to uri="http://remote/service/address />

<process ref="streamToSoapMessage" /> <!-- converts stream to 
SOAPMessage -->
</route>
</camelContext>

--
Paweł Wesołowski