You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Otavio Rodolfo Piske (Jira)" <ji...@apache.org> on 2023/02/15 17:00:00 UTC
[jira] [Commented] (CAMEL-19056) Evaluate implementing a fluent context builder
[ https://issues.apache.org/jira/browse/CAMEL-19056?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17689248#comment-17689248 ]
Otavio Rodolfo Piske commented on CAMEL-19056:
----------------------------------------------
[~davsclaus] [~acosentino] I've been thinking about this as one of the future improvements for the CamelContext API (naturally, with a layer to allow users to transition smoothly). What do you think?
> Evaluate implementing a fluent context builder
> -----------------------------------------------
>
> Key: CAMEL-19056
> URL: https://issues.apache.org/jira/browse/CAMEL-19056
> Project: Camel
> Issue Type: Task
> Reporter: Otavio Rodolfo Piske
> Priority: Major
>
> After we finish streamlining the extensions interface on the {{{}CamelContext{}}}, we can evaluate creating a fluent interface API for building contexts. Therefore, we could try to separate the context configuration from the instantiation and provide the context configuration that is suitable for the user / scenario.
> For instance, today users have to do something like this:
>
> {code:java}
> CamelContext context = new DefaultContext();
>
> context.setName("something");
> context.setDescription("another thing");
> // an so on.
> {code}
>
> In concrete terms, we could investigate modifying the configuration of the
>
>
> {code:java}
> CamelContext context = ContextConfigurationBuilder
> .newDefaultConfiguration()
> .withName("something")
> .withDescription("another thing")
> .build()
>
> // No need for setters on the context -> make it immutable
> {code}
>
> We can also provide configurationBuilders for scenarios where immutability is undesired as well as allowing the build of contexts with the older API for users converting to 4.x
>
> {code:java}
>
> ContextConfigurationBuilder
> .newDefaultConfiguration()
> .withName("something")
> .withDescription("another thing")
> .buildLegacy()
> {code}
>
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)