Reputation: 55
I have two routes in one 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 I use facebook component. I want to call http://localhost:8765/getLikes and get all likes from facebook which second route will get. But first route cannot find the second one
Upvotes: 2
Views: 6982
Reputation: 1771
You have to use components like direct (http://camel.apache.org/direct) or seda (http://camel.apache.org/seda.html) for 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 you need to set some headers here -->
<to uri="facebook://userLikes?oAuthAppId={{oAuthAppId}}&oAuthAppSecret={{oAuthAppSecret}}&oAuthAccessToken={{oAuthAccessToken}}" />
<log message="The message contains ${body}" />
</route>
</camelContext>
This link https://people.apache.org/~dkulp/camel/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html can be helpful for you too.
Upvotes: 6