You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ee7arh <an...@2e-systems.com> on 2010/03/06 16:37:18 UTC

Avoiding string literals in DSL

Hi,

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 +
"?method=myMethod");

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
Andrew

-- 
View this message in context: http://old.nabble.com/Avoiding-string-literals-in-DSL-tp27805047p27805047.html
Sent from the Camel - Users mailing list archive at Nabble.com.