[
https://issues.apache.org/jira/browse/CAMEL-19056?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-19056.
---------------------------------
Resolution: Won't Fix
Its not common to build your own CamelContext as its automatic created in
CSB/CEQ/Main et all.
> Evaluate implementing a fluent context builder
> -----------------------------------------------
>
> Key: CAMEL-19056
> URL: https://issues.apache.org/jira/browse/CAMEL-19056
> Project: Camel
> Issue Type: Task
> Components: camel-core
> Reporter: Otavio Rodolfo Piske
> Assignee: 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 to look
> like this:
> {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}
>
> CamelContext context = ContextConfigurationBuilder
> .newDefaultConfiguration()
> .withName("something")
> .withDescription("another thing")
> .buildLegacy(); // returns a context instance with all the setters /
> getters that the users may expect {code}
>
> The main goals are to:
> 1. Allow the creation of contexts that are truly immutable
> 2. Simplify removing / abstracting runtime configuration that may not be
> needed in some cases (thus helping keeping the context lightweight for
> Quarkus, Camel K and other scenarios)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)