Get JSON data in ActiveMQ using Spring and Apache Camel -
i new retrieve json file url: https://builds.apache.org/job/accumulo-1.5/api/json
i put url in activemq code looks this:
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <bean id="jms" class="org.apache.camel.component.jms.jmscomponent"> <property name="connectionfactory"> <bean class="org.apache.activemq.activemqconnectionfactory"> <!--link naar activemq--> <property name="brokerurl" value="tcp://localhost:61616"/> </bean> </property> </bean> <bean id="downloadlogger" class="camelinaction.downloadlogger"/> <camelcontext xmlns="http://camel.apache.org/schema/spring"> <dataformats> <json id="json" library="jackson"/> </dataformats> <route> <from uri="jetty:https://builds.apache.org:443/job/accumulo-1.5/api/json"/> <process ref="downloadlogger"/> <to uri="jms:testqueue"/> </route> <route> <from uri="jms:testqueue"/> <process ref="downloadlogger"/> <to uri="file:src/result"/> </route> </camelcontext> </beans>
the queue working. tried put xml file in queue , wasn't problem. input of route configuration link existing url.
is possible? if yes, fault?
thanks in advance.
fixed using java dsl in stead of spring dsl.
solution:
@component public class accumolotojmsroutebuilder extends springroutebuilder { @override public void configure() throws exception { from("timer://foo?fixedrate=true&delay=0&period=2000&repeatcount=1") .setheader(exchange.http_method, constant("get")) .to("https://builds.apache.org:443/job/accumulo-1.5/api/json") .convertbodyto(string.class) .to("myprocessor") .log(logginglevel.debug, "com.project", "http response body: ${body}") .to("activemq://testqueue"); } }
Comments
Post a Comment