Thursday, June 13, 2013

Spring XD JMS Source using Spring Integration

Spring XD - JMS input

Spring XD is a fantastic new framework to help ingest data from a variety of inputs and process them out.  there's a bunch of 'source' points that come with Spring XD, but one that i wanted to use was JMS (grab my JMS messages and stick it in Hadoop…)  so, here's a simple one that works with Spring XD 1.0.0.M1

i'm using Spring Integration, so here's the JMS listener



here's the connection factory for the database


now this is what i need to do to add it to my Spring XD;
  • add the jms-source-module.xml to $SPRING_XD/modules/source
  • add the package jar to $SPRING_XD/lib
  • add the following 'supporting' jars
    • activemq-core-5.5.1.jar
    • spring-integration-jms-2.2.3.RELEASE.jar
    • spring-jms-3.2.1.RELEASE.jar
    • geronimo-jms_1.1_spec-1.1.1.jar
    • geronimo-j2ee-management_1.1_spec-1.0.1.jar

now start up the activemq server

$ACTIVE_MQ/bin/activemq start
and startup spring-xd

now to start it the 'listener'

curl -d "jms-source-module | log" http://localhost:8080/streams/jmstest

or if you're going to use hadoop as the consumer

curl -d "jms-source-module | hdfs --rollover=10" http://localhost:8080/streams/jmstest

and send a message (via the console is an easy way to test)

now, you should see it show up in the log file of spring xd (remember, "log" was specified after the pipe)

to see it in hadoop, try the following

./hadoop fs -ls /xd/jmstest

No comments:

Post a Comment