On Thu, Jun 5, 2014 at 12:54 AM, Minh Tran <[email protected]> wrote:
> What would be cool is if camel provides a way for users to determine the 
> names of those routes. Like the NamingStrategy in Hibernate. That way we can 
> override the standard naming of routes. I'd like for something like if the 
> route begins with jms then I would name it jmsRoute1, if it starts with 
> quartz, then quartzRoute1 or something along those lines. Much easier to 
> identify than route1 route2 etc.
>

You can use a custom node id factory to do that
http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/NodeIdFactory.html

> On 05/06/2014, at 1:06 AM, kraythe . <[email protected]> wrote:
>
>> To be clear the third route is superfluous to your argument.
>>
>> Your argument is that auto-generated route IDs can use the same route ID as
>> an explicit route ID set to be the same as the auto-generated one.
>>
>> You could propose the route builder core check if a route id is used before
>> generating a new ID. The reality is that it wouldn't know that another
>> route builder later wouldn't choose the same route ID it just picked. So if
>> you flip over the route build order, the builder would have to be
>> clairvoyant to know that later the user will use the given route id it just
>> picked. Furthermore that route using the same name could be in another
>> route builder completely. What is the core to do, tell you you cant use
>> that route ID? I suppose that is a possibility. The route builder could
>> throw an exception if you used an ID explicitly that is in use.
>>
>> The Jira issues would be something like:
>>
>> 1) When route ID is not specified route builder core should auto-generate
>> guaranteed unique ID and make sure that ID is not already in use.
>> 2) If a user sets an explicit route id, when the route is built, if that ID
>> is already used, the core should throw an exception at route construction
>> time.
>>
>> Should be a small fix.
>>
>> In the meantime .... don't do that. :)
>>
>> *Robert Simmons Jr. MSc. - Lead Java Architect @ EA*
>> *Author of: Hardcore Java (2003) and Maintainable Java (2012)*
>> *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39
>> <http://www.linkedin.com/pub/robert-simmons/40/852/a39>*
>>
>>
>> On Thu, May 29, 2014 at 9:44 PM, Ernest Lu <[email protected]> wrote:
>>
>>> Hi,
>>>
>>> I have three RouteDefinitions,as follows.
>>>
>>> from("direct:start")
>>> .routeId("route1")
>>> .to("mock:end")
>>>
>>> from("direct:start2")
>>> .to("mock:end")
>>>
>>> from("jetty:http://0.0.0.0:15124/download";)
>>> .removeHeader(Exchange.HTTP_URI)
>>> .routeId("filedownload")
>>> .to("http://127.0.0.1:8090/camel.doc";)
>>>
>>> The first RouteDefinition specify  route ID("route1") and the second not,
>>> so the second RouteDefinition  will AUTO generate route id which same as
>>> the
>>> first RouteDefinition id.
>>>
>>> In third RouteDefinition,I want to download a file by http proxy,but the
>>> http response will lose file name.
>>>
>>> 我英语水平有点渣...
>>>
>>> 上面3个路由 第一个路由如果指定ID为"route1",第二个不指定ID,第二个就会生成名为'route1'的ID,和第一个重复了。
>>>
>>> 第三个路由 我想通过代理下载一个文件,但是下载的文件的名字和后缀名都丢失了,在message中的header里面也找不到文件名了,要怎么做.
>>>
>>>
>>> Thanks!
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://camel.465427.n5.nabble.com/I-found-a-bug-tp5751728.html
>>> Sent from the Camel - Users mailing list archive at Nabble.com.
>>>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: [email protected]
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Reply via email to