在camel DSL中表示来自xml的路由列表

发布于 2024-12-04 18:26:16 字数 1471 浏览 1 评论 0原文

我怎样才能在Camel的DSL中表示这条路线:

   <camel:camelContext id="camel-context">
      <camel:route id="conductor-event" trace="true">
         <camel:from uri="direct:conductor/event"/>
         <camel:log message="handling conductor-event: id=${exchangeId}"/>
         <!-- execute each filter in sorted order -->
         <camel:bean ref="beaner.BProcessors"/>
         <camel:log message="after: [bprocessors]: id=${exchangeId}"/>
         <!-- map the event to a route -->
         <camel:recipientList parallelProcessing="false">
            <camel:method ref="beaner.Mappings" />
         </camel:recipientList>
         <camel:log message="after event mapping: id=${exchangeId}"/>
      </camel:route>
   </camel:camelContext>

到目前为止我已经有了这个,但是我得到一个“由:java.net.URISyntaxException:索引0处的方案名称中的非法字符:%7BCamelToEndpoint = ...”引起的:

    RouteDefinition routeDef = from("direct:conductor/event")
    .log( "handling conductor-event: id=${exchangeId}" )
    .beanRef( "beaner.BProcessors" )
    .log( "after: [bprocessors]: id=${exchangeId}" );
    ExpressionClause<RecipientListDefinition<RouteDefinition>> recipientList = routeDef.recipientList();
    recipientList.properties().setParallelProcessing( false );
    recipientList.method( "beaner.EventMappings" );
    routeDef.log( "after event mapping: id=${exchangeId}" );

How can I represent this route in Camel's DSL:

   <camel:camelContext id="camel-context">
      <camel:route id="conductor-event" trace="true">
         <camel:from uri="direct:conductor/event"/>
         <camel:log message="handling conductor-event: id=${exchangeId}"/>
         <!-- execute each filter in sorted order -->
         <camel:bean ref="beaner.BProcessors"/>
         <camel:log message="after: [bprocessors]: id=${exchangeId}"/>
         <!-- map the event to a route -->
         <camel:recipientList parallelProcessing="false">
            <camel:method ref="beaner.Mappings" />
         </camel:recipientList>
         <camel:log message="after event mapping: id=${exchangeId}"/>
      </camel:route>
   </camel:camelContext>

I have this so far, but I get a "Caused by: java.net.URISyntaxException: Illegal character in scheme name at index 0: %7BCamelToEndpoint=...":

    RouteDefinition routeDef = from("direct:conductor/event")
    .log( "handling conductor-event: id=${exchangeId}" )
    .beanRef( "beaner.BProcessors" )
    .log( "after: [bprocessors]: id=${exchangeId}" );
    ExpressionClause<RecipientListDefinition<RouteDefinition>> recipientList = routeDef.recipientList();
    recipientList.properties().setParallelProcessing( false );
    recipientList.method( "beaner.EventMappings" );
    routeDef.log( "after event mapping: id=${exchangeId}" );

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

孤独难免 2024-12-11 18:26:16

这是 JavaDSL 中的路由...请注意,recipientList parallelProcessing 默认情况下为 false...

from("direct:conductor/event")
    .log("handling conductor-event: id=${exchangeId}")
    .beanRef("beaner.BProcessors")
    .log("after: [bprocessors]: id=${exchangeId}")
    .recipientList(bean("beaner.Mappings"))
    .log("after event mapping: id=${exchangeId}");

here is the route in JavaDSL...note that the recipientList parallelProcessing is false by default...

from("direct:conductor/event")
    .log("handling conductor-event: id=${exchangeId}")
    .beanRef("beaner.BProcessors")
    .log("after: [bprocessors]: id=${exchangeId}")
    .recipientList(bean("beaner.Mappings"))
    .log("after event mapping: id=${exchangeId}");
御守 2024-12-11 18:26:16

您应该在Java DSL中使用RouteBuilder类来访问DSL。
然后,在配置方法中,您可以构建几乎与XML DSL相同的路由。

请参阅此处的“入门指南: http://camel.apache.org/walk-----贯穿An-example.html

You should use a RouteBuilder class in Java DSL to access the DSL.
Then inside the configure method you can build the routes almost identical as in XML DSL.

See the getting started guide here: http://camel.apache.org/walk-through-an-example.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文