how to set id of camel processor or other route ingredients

不问归期 提交于 2020-01-14 00:17:07

问题


Camel automatically generates id for processors and other stuff (processor1..processor25). Is there a way to set this name? We need to identify certain processors via jmx to get telemetry data.

The names I want to set are given via properties - they are known on start time. So I need to set them when route is defined or within the processor (name is given via processors constructor, the string is also used for processing).

Update

Example: for a route from("some:where").process(myProcessor).to(no:where) i need to set the id of myProcessor. I need "ExchangesTotal" and other stuff from certain processors

I need a solution in Java DSL.


回答1:


If using xml then use the id attribute.

<to id="foo" uri="seda:foo"/>

And if using java code, then use .id

.to("seda:bar").id("foo");

And one special is to set the id of the route, which you must use .routeId

from("xxx").routeId("id of the route")
   .to("xxx")

So your example should be

from("some:where").process(myProcessor).id("theIdOfTheProcessorYouWant").to(no:where)


来源:https://stackoverflow.com/questions/28578680/how-to-set-id-of-camel-processor-or-other-route-ingredients

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!