Created
November 16, 2012 01:40
-
-
Save bijukunjummen/4083151 to your computer and use it in GitHub Desktop.
Spring Integration Http Outbound with Poller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<beans xmlns="http://www.springframework.org/schema/beans" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xmlns:int="http://www.springframework.org/schema/integration" | |
xmlns:int-http="http://www.springframework.org/schema/integration/http" | |
xsi:schemaLocation="http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd | |
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | |
http://www.springframework.org/schema/integration/http http://www.springframework.org/schema/integration/http/spring-integration-http.xsd"> | |
<int:inbound-channel-adapter channel="quakeinfotrigger.channel" expression="''"> | |
<int:poller fixed-delay="60000"></int:poller> | |
</int:inbound-channel-adapter> | |
<int:channel id="quakeinfo.channel"> | |
<int:queue capacity="10"/> | |
</int:channel> | |
<int:channel id="quakeinfotrigger.channel"></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> | |
</beans> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package outbound; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.is; | |
import static org.hamcrest.Matchers.notNullValue; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import org.springframework.beans.factory.annotation.Autowired; | |
import org.springframework.beans.factory.annotation.Qualifier; | |
import org.springframework.integration.Message; | |
import org.springframework.integration.core.PollableChannel; | |
import org.springframework.test.context.ContextConfiguration; | |
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; | |
@RunWith(SpringJUnit4ClassRunner.class) | |
@ContextConfiguration("httpgateway.xml") | |
public class TestHttpOutboundGateway { | |
@Autowired @Qualifier("quakeinfo.channel") PollableChannel quakeinfoChannel; | |
@Test | |
public void testHttpOutbound() { | |
Message<?> message = quakeinfoChannel.receive(); | |
assertThat(message.getPayload(), is(notNullValue())); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you have annotation version of this?