diff --git a/src/reference/asciidoc/dsl.adoc b/src/reference/asciidoc/dsl.adoc index 9d7700efe7..75ba95b7b3 100644 --- a/src/reference/asciidoc/dsl.adoc +++ b/src/reference/asciidoc/dsl.adoc @@ -382,12 +382,12 @@ The fluent API also provides `AbstractMappingMessageRouter` options such as `cha [source,java] ---- @Bean -public IntegrationFlow routeFlow() { +public IntegrationFlow routeFlowByLambda() { return IntegrationFlows.from("routerInput") .route(p -> p % 2 == 0, m -> m.suffix("Channel") - .channelMapping("true", "even") - .channelMapping("false", "odd") + .channelMapping(true, "even") + .channelMapping(false, "odd") ) .get(); } @@ -400,7 +400,7 @@ The following example shows a simple expression-based router: [source,java] ---- @Bean -public IntegrationFlow routeFlow() { +public IntegrationFlow routeFlowByExpression() { return IntegrationFlows.from("routerInput") .route("headers['destChannel']") .get(); @@ -417,21 +417,21 @@ The `routeToRecipients()` method takes a `Consumer`, as public IntegrationFlow recipientListFlow() { return IntegrationFlows.from("recipientListInput") .transform(p -> p.replaceFirst("Payload", "")) - .routeToRecipients(r -> r - .recipient("thing1-channel", "'thing1' == payload") - .recipient("thing2-channel", m -> - m.getHeaders().containsKey("recipient") - && (boolean) m.getHeaders().get("recipient")) - .recipientFlow("'thing1' == payload or 'thing2' == payload or 'thing3' == payload", - f -> f.transform(String::toUpperCase) - .channel(c -> c.queue("recipientListSubFlow1Result"))) - .recipientFlow((String p) -> p.startsWith("thing3"), - f -> f.transform("Hello "::concat) - .channel(c -> c.queue("recipientListSubFlow2Result"))) - .recipientFlow(new FunctionExpression>(m -> - "thing3".equals(m.getPayload())), - f -> f.channel(c -> c.queue("recipientListSubFlow3Result"))) - .defaultOutputToParentFlow()) + .routeToRecipients(r -> r + .recipient("thing1-channel", "'thing1' == payload") + .recipientMessageSelector("thing2-channel", m -> + m.getHeaders().containsKey("recipient") + && (boolean) m.getHeaders().get("recipient")) + .recipientFlow("'thing1' == payload or 'thing2' == payload or 'thing3' == payload", + f -> f.transform(String::toUpperCase) + .channel(c -> c.queue("recipientListSubFlow1Result"))) + .recipientFlow((String p) -> p.startsWith("thing3"), + f -> f.transform("Hello "::concat) + .channel(c -> c.queue("recipientListSubFlow2Result"))) + .recipientFlow(new FunctionExpression>(m -> + "thing3".equals(m.getPayload())), + f -> f.channel(c -> c.queue("recipientListSubFlow3Result"))) + .defaultOutputToParentFlow()) .get(); } ----