jbossfuse - Apache Camel, calling one route from another -
i have 2 routes in 1 camel context.
<camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <propertyplaceholder location="classpath:facebook.properties" id="properties" /> <route> <from uri="jetty:http://0.0.0.0:8765/getlikes" /> <to uri="facebook" /> </route> <route> <from uri="facebook://userlikes?oauthappid={{oauthappid}}&oauthappsecret={{oauthappsecret}}&oauthaccesstoken={{oauthaccesstoken}}" /> <log message="the message contains ${body}" /> </route> </camelcontext>
in second route use facebook component. want call http://localhost:8765/getlikes , likes facebook second route get. first route cannot find second one
you have use components direct (http://camel.apache.org/direct) or seda (http://camel.apache.org/seda.html) this:
<camelcontext xmlns="http://camel.apache.org/schema/blueprint"> <propertyplaceholder location="classpath:facebook.properties" id="properties" /> <route> <from uri="jetty:http://0.0.0.0:8765/getlikes" /> <to uri="direct:facebook" /> </route> <route> <from uri="direct:facebook" /> <!-- maybe need set headers here --> <to uri="facebook://userlikes?oauthappid={{oauthappid}}&oauthappsecret={{oauthappsecret}}&oauthaccesstoken={{oauthaccesstoken}}" /> <log message="the message contains ${body}" /> </route> </camelcontext>
this link http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html can helpful too.
Comments
Post a Comment