Adrian Ber
Adrian Ber

Reputation: 21390

Spring Integration: Poll HTTP

How can I poll a HTTP web service using Spring Integration.

<int-http:outbound-gateway request-channel="in" reply-channel="out"
    url="http://whatever.com" http-method="GET" 
    expected-response-type="java.lang.String"/>

The http outbound gateway doesn't support poller like the Twitter one.

Of course there is the possibility to create a dummy gateway to send empty messages and to configure this using a task scheduler.

Upvotes: 0

Views: 1550

Answers (1)

Adrian Ber
Adrian Ber

Reputation: 21390

Actually it is a pretty clean and nice solution to create an inbound-channel-adapter, like this

<int:inbound-channel-adapter id="in" expression="''" auto-startup="true" >
    <int:poller cron="* */30 * * * *" max-messages-per-poll="3" />
</int:inbound-channel-adapter>

The above one will automatically start(default behavior, anyway) and poll every 30 seconds.

Upvotes: 3

Related Questions