我在一个骆驼语境中有两条路线。
<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>
在第二个路线中我使用facebook组件。 我想打电话给http://localhost:8765/getLikes并从第二条路线获得所有来自facebook的喜欢。但第一条路线找不到第二条
答案 0 :(得分:2)
您必须使用直接(http://camel.apache.org/direct)或 seda (http://camel.apache.org/seda.html)等组件:
<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>
此链接http://camel.apache.org/how-to-use-camel-as-a-http-proxy-between-a-client-and-server.html对您也有帮助。