1

I have a restful service with uri

 http://<host>:<port>/resource/Item/100

where 100 is a parameter. How do i set up a from camel route in xml for this

<camel:route id="A">
  <camel:from uri="http://<host>:<port>/resource/Item/{param}">
4

1 回答 1

0

如果您使用 camel-restlet 作为 restlet 服务,请阅读其文档:http ://camel.apache.org/restlet - 它提供了如何定义参数的示例。

虽然您上面的示例已经将 100 定义为 {param},但您可以给它任何您喜欢的名称,例如 itenNumber、itemNo 等

<camel:from uri="restlet:http://<host>:<port>/resource/Item/{itemNo}">

然后在 Camel {itemNo} 中映射到消息的标题,例如:itemNo = key,以及内容的值,例如您的示例中的 100。

在即将发布的 Apache Camel 2.12 版本中,我们有一个开箱即用的 camel-restlet-jdbc 示例。你可以在这里找到它的源代码,你可以在这里看到一个例子:https ://git-wip-us.apache.org/repos/asf?p=camel.git;a=tree;f=examples/camel-example-restlet -jdbc;h=e4796a8cbe84dedae4bc0ec98e8997128c9be7a6;hb=HEAD

除了camel-restlet 之外,camel-cxfrs 也可以用于restful 服务。

于 2013-08-30T06:00:27.433 回答