【问题标题】:Fluent Rest configuration in Camel 2.14.0Camel 2.14.0 中的 Fluent Rest 配置
【发布时间】:2014-09-19 06:36:49
【问题描述】:

我在 Camel 中使用 2.14.0 中的新 rest 组件,并使用以下配置:

DefaultCamelContext context = new DefaultCamelContext();

RestConfiguration rc = new RestConfiguration();
rc.setComponent("spark-rest");
rc.setPort(9091);
context.setRestConfiguration(rc);

rest-dsl page 中,有一些参考资料显示了一种使用 fluent dsl 配置 rest 的方法,例如:

restConfiguration()
 .component("restlet")
 .host("localhost")
 .port(portNum)
 .bindingMode(RestBindingMode.auto);

但我似乎找不到合适的占位符添加到哪里。

简而言之,camel 文档显示了一种使用 fluent DSL 配置 Camel 上下文的方法,但我找不到在哪里/如何做。

【问题讨论】:

  • 你的问题是什么?

标签: java rest apache-camel dsl


【解决方案1】:

最后是正确放置所需的火花。那是在路由构建器配置方法中。

protected RouteBuilder createRouteBuilder() throws Exception {
  return new RouteBuilder() {
    public void configure() throws Exception {
      restConfiguration()
      .component("spark-rest")
      .port(9091);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-16
    相关资源
    最近更新 更多