Otavio Rodolfo Piske created CAMEL-19056:
--------------------------------------------

             Summary: 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


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)

Reply via email to