2011-09-15 94 views
1

我怎么能代表骆驼的DSL这条路线:较XML骆驼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}"); 
+0

仅供参考,如果我走了 “recipientList.properties()setParallelProcessing(假);”它工作正常... – arinte

回答

2

这里是JavaDSL路线......注意,recipientList并行处理默认为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}");