camel-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@gmail.com>
Subject Re: [Discuss] How to make the java DSL cleaner and less complex
Date Fri, 22 Jul 2011 10:32:09 GMT
On Fri, Jul 22, 2011 at 10:55, Christian Schneider
<chris@die-schneider.net> wrote:
> 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?

Yes, scala rocks !!!

More seriously, if anything need to change (for 3.0 for example), what
about something like

from("seda:start")
    .threads(executorService(pool).callerRunsWhenRejected(false))
    .delay(1000).to("mock:result");
rather than adding a new ThreadPoolProfileBuilder and a call to build ?

>
> Christian
>
> --
> --
> Christian Schneider
> http://www.liquid-reality.de
>
> Open Source Architect
> Talend Application Integration Division http://www.talend.com
>
>



-- 
------------------------
Guillaume Nodet
------------------------
Blog: http://gnodet.blogspot.com/
------------------------
Open Source SOA
http://fusesource.com

Mime
View raw message