Hi all,

I have taken a look at the current Java DSL. There i especially one thing that bugs me.

When we configure defintion like threads we do not clearly state where it ends. So for example:

from("seda:start").threads().executorService(pool).callerRunsWhenRejected(false).delay(1000).to("mock:result");

So after threads() we can either configure the threads definition or go on with the next definition. While this is very short it is also quite unclear. Additionally the code completion in java mixes the threads attributes with the other dsl elements. So it is more difficult for the user to see how the threads can be configured.

I can think of two alternative syntaxes that would be cleaner an help the user better:

1. Using an end marker
from("seda:start")
    .threads().executorService(pool).callerRunsWhenRejected(false).end()
    .delay(1000).to("mock:result");
So after threads() the code completion will only show the attributes of threads and the end() marker.

2. Configuring the definition using a Builder as a parameter:
from("seda:start")
.threads(new ThreadPoolProfileBuilder().executorService(pool).callerRunsWhenRejected(false).build())
    .delay(1000).to("mock:result");
The .build could be optional as we could accept a ThreadPoolProfile as well as ThreadPoolProfileBuilder as an argument.

Any opinions about that?

Christian

--
--
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
Talend Application Integration Division http://www.talend.com

Reply via email to