Hi,

I'm working to make the Java DSL more Java 8 friedly adding missing
pieces from the previous Java 8 round and one of the thing that was
missing was the possibility to use Suppliers to provides objects to
the routes.

As today:

    from("direct:start")
        .idempotentConsumer()
            .header("messageId")
            .messageIdRepository(createRepo())
        .to("mock:result");


With suppliers:

    from("direct:start")
        .idempotentConsumer()
            .header("messageId")
            .messageIdRepository(this::createRepo)
        .to("mock:result");


Adding that does not result in such a big improvement for the DSL but
it adds some overhead to the underlying definitions as we may need to
add additional variables to hold the suppliers and other stuffs to
convert suppliers i.e. to expression clause so I'm unsure if we should
add such things in 2.19 or maybe delay to 3.0 (where we may have the
chance to do a deeper refactor and suppliers may play better),


What do you think ?


---
Luca Burgazzoli

Reply via email to