Guillaume Nodet created CAMEL-13295:
---------------------------------------
Summary: Add a helper method to easily add a route
Key: CAMEL-13295
URL: https://issues.apache.org/jira/browse/CAMEL-13295
Project: Camel
Issue Type: Improvement
Reporter: Guillaume Nodet
Assignee: Guillaume Nodet
Fix For: 3.0.0-M2
Using the following method in `ModelCamelContext`
{code:java}
default void addRoute(ThrowingConsumer<RouteBuilder, Exception> rbc) throws
Exception {
addRoutes(new RouteBuilder() {
@Override
public void configure() throws Exception {
rbc.accept(this);
}
});
}
{code}
we can simply blocks such as
{code}
new RouteBuilder() {
@Override
public void configure() throws Exception {
from(u).to("reactive-streams:" + uuid);
}
}.addRoutesToCamelContext(context);
{code}
into
{code}
context.adapt(ModelCamelContext.class).addRoute(rb ->
rb.from(u).to("reactive-streams:" + uuid));
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)