Hi, I need a little help with the right way to poll to an external json based HTTP service using http gateway. I have requirement where I have to poll an external http json based service every minute and get the data into the messaging system. I would have assumed that an http inbound adapter/gateway would have been the right fit, but it behaves differently, it essentially exposes an http endpoint and expect the calls to come in.
So it sounds like a http outbound gateway is what I have to use. However, since it is a outbound gateway which gets triggered based on the availability of a message in a channel, I have to artificially put a dummy message in a channel to trigger the outbound http gateway to get a message in, this way:
So my question is - Is there a better way to do this?Code:<int:channel id="quakeinfotrigger.channel"></int:channel> <int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="@triggerChannelAdapter.trigger()"> <int:poller fixed-delay="60000"></int:poller> </int:inbound-channel-adapter> <int:channel id="quakeinfo.channel"> <int:queue capacity="10"/> </int:channel> <int-http:outbound-gateway id="quakerHttpGateway" request-channel="quakeinfotrigger.channel" url="http://earthquake.usgs.gov/earthquakes/feed/geojson/all/hour" http-method="GET" expected-response-type="java.lang.String" charset="UTF-8" reply-timeout="5000" reply-channel="quakeinfo.channel"> </int-http:outbound-gateway>


Reply With Quote