So I just pushed a few changes to be able to actually integrate the
endpoint DSL in the existing DSL easily.
In order to leverage it, you need to inherit the EndpointBuilder interface
somehow, then you have access to methods named fromXxx and toXxx for each
endpoint.
The test case has been refactored and now looks like:

from(fromFile("target/data/files/").initialDelay(0).delay(10).fileName(constant("report.txt")).delete(true).charset("UTF-8"))
    .convertBodyTo(String.class)
    .to(toMock("result"));


https://github.com/apache/camel/blob/c2dd5c80a82ad982127105f9ae5afde674bbe214/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java#L60-L62

Any suggestions ?


Le jeu. 6 juin 2019 à 12:01, Guillaume Nodet <gno...@apache.org> a écrit :

> I've just pushed a working test case:
>
> https://github.com/apache/camel/blob/bcaa3ce64d9f1a5fd2ee9fcb154c7a2682c9979e/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java#L57-L59
>
> It's missing the generation of the dsl methods for each endpoint consumer
> / producer (see
> https://github.com/apache/camel/blob/bcaa3ce64d9f1a5fd2ee9fcb154c7a2682c9979e/core/camel-core/src/test/java/org/apache/camel/component/file/FileConsumeCharsetTest.java#L64-L69)
> but I'm not sure yet where/how to nicely plug them in the DSL.
>
> Ideas and feedback welcome !
>
>
> Le mer. 5 juin 2019 à 23:23, Guillaume Nodet <gno...@apache.org> a écrit :
>
>> I just pushed a branch called "endpoint-dsl".
>>
>> My goal is to experiment with an auto-generated DSL for endpoints, mainly
>> to have a complete and type-safe java DSL for endpoints instead of using
>> URI containing all the parameters.  Right now, it compiles but isn't really
>> usable at a DSL.
>> I'll get back as soon as I have something which can actually be used so
>> that we can discuss further various options.
>> My rough goal is to be able to write something like:
>>
>>    from(file("target/data/foo").delay(4000).backoffMultiplier(4
>> ).backoffIdleThreshold(2).backoffErrorThreshold(3))
>>       .to(mock("result"))
>>
>> instead of
>>
>>    from(
>> "file://target/data/foo?delay=4000&backoffMultiplier=4&backoffIdleThreshold=2&backoffErrorThreshold=3"
>> )
>>       .to("mock:result")
>>
>> Stay tuned !
>>
>> --
>> ------------------------
>> Guillaume Nodet
>>
>>
>
> --
> ------------------------
> Guillaume Nodet
>
>

-- 
------------------------
Guillaume Nodet

Reply via email to