camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ee7arh <>
Subject Avoiding string literals in DSL
Date Sat, 06 Mar 2010 15:37:18 GMT


We are heavily using DSL routers to route messages from one bean to another
within our messaging application.

All the examples I find in the documentation using beans always show the
bean name and the method name as a string. This is fine and it works but
when we are debugging a DSL router and want to jump the POJO method in
question, we have to do a plain old String search in the project to find the
bean and the method in question.

Is there a better way to do this so that our IDE can jump to the correct
bean and method automatically like in regular java code?

For the name of the bean we can do something like this>

@Service (value = MyBean.SERVICE_NAME)
public class MyBean {

    public static final String SERVICE_NAME = "myBeanRef";

    public void myMethod() {}

Then in the DSL, you can refer to the bean like this:

from("activemq:queue:myQueue").to("bean:" + MyBean.SERVICE_NAME +

So when debugging the DSL, we can jump directly to the bean in question in
the IDE but what about the method? Also if I refactor the method and change
it's name, I have to go and change the above string literal which can lead
to mistakes?

Anybody any tips on making DSL routers a bit more robust in this way?

Thanks and BRegards

View this message in context:
Sent from the Camel - Users mailing list archive at

View raw message