Results 1 to 10 of 12

Thread: Handling connectivity issues in web service outbound gateway (retry)

Threaded View

  1. #1
    Join Date
    May 2011
    Posts
    13

    Question Handling connectivity issues in web service outbound gateway (retry)

    Currently, we have a requirement to attempt a WS request, and in the case that the remote endpoint is down, queue the request for retry. This queue should also be backed by a database, so that if the application goes down, the requests will be retried once it is restarted.

    I am hoping that I can achieve this purely with Spring Integration. My thought was that I could use a WS Outbound Gateway, with a message-store-backed queue channel set as the error channel. The error channel would be polled, and the message would be sent to a retry gateway (via Service Activator) which would also hook up to the WS Outbound Gateway, and basically form a processing loop.

    The idea of the Service Activator and retry Gateway was taken from one of Oleg's SpringOne 2GX examples. The polling is happening properly, but I can't figure out how to "complete the loop" and actually get the retry to happen. Oddly, the poller seems to stop after the retry gateway is invoked.

    Here is what I have currently:

    HTML Code:
            <!-- Will replace this with a JDBC store later -->
            <bean id="testMessageStore" class="org.springframework.integration.store.SimpleMessageStore" />
    
            <int:channel id="wsRequestChannel" />
            <int:channel id="wsReplyChannel" />
            <int:channel id="wsErrorChannel">
                <int:queue message-store="testMessageStore" />
            </int:channel>
    
            <int:channel id="testChannel" />
            <int:chain input-channel="wsErrorChannel" auto-startup="true">
                <int:poller fixed-rate="5000">
                    <int:transactional transaction-manager="transactionManager" />
                </int:poller>
                <int:transformer expression="payload.getFailedMessage().getPayload() + ' '" />
                <!-- Everything seems to work fine up to here, but how do I get it to retry the WS? -->
                <int:service-activator ref="retryGateway" />
            </int:chain>
    
            <int:chain input-channel="wsRequestChannel" output-channel="wsReplyChannel">
                <int-ws:header-enricher>
                    <int-ws:soap-action value="theTargetSoapAction" />
                </int-ws:header-enricher>
                <int-ws:outbound-gateway id="testWsGateway" uri="https://someSOAPService" interceptor="wsSecurityInterceptor" />
            </int:chain>
    
            <int:gateway id="mainGateway" default-request-channel="wsRequestChannel" default-reply-channel="wsReplyChannel" error-channel="wsErrorChannel" service-interface="com.mypackage.IntegrationTestService">
                <int:method name="sendMessage" />
            </int:gateway>
            <int:gateway id="retryGateway" default-request-channel="wsRequestChannel" default-reply-channel="wsReplyChannel" error-channel="wsErrorChannel" />

    Can anyone help with this, or offer up suggestions for alternative approaches?
    Thanks!
    Last edited by ach; Jul 18th, 2012 at 08:03 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •