@@ -382,12 +382,12 @@ The fluent API also provides `AbstractMappingMessageRouter` options such as `cha
382
382
[source,java]
383
383
----
384
384
@Bean
385
- public IntegrationFlow routeFlow () {
385
+ public IntegrationFlow routeFlowByLambda () {
386
386
return IntegrationFlows.from("routerInput")
387
387
.<Integer, Boolean>route(p -> p % 2 == 0,
388
388
m -> m.suffix("Channel")
389
- .channelMapping(" true" , "even")
390
- .channelMapping(" false" , "odd")
389
+ .channelMapping(true, "even")
390
+ .channelMapping(false, "odd")
391
391
)
392
392
.get();
393
393
}
@@ -400,7 +400,7 @@ The following example shows a simple expression-based router:
400
400
[source,java]
401
401
----
402
402
@Bean
403
- public IntegrationFlow routeFlow () {
403
+ public IntegrationFlow routeFlowByExpression () {
404
404
return IntegrationFlows.from("routerInput")
405
405
.route("headers['destChannel']")
406
406
.get();
@@ -417,21 +417,21 @@ The `routeToRecipients()` method takes a `Consumer<RecipientListRouterSpec>`, as
417
417
public IntegrationFlow recipientListFlow() {
418
418
return IntegrationFlows.from("recipientListInput")
419
419
.<String, String>transform(p -> p.replaceFirst("Payload", ""))
420
- .routeToRecipients(r -> r
421
- .recipient("thing1-channel", "'thing1' == payload")
422
- .recipient ("thing2-channel", m ->
423
- m.getHeaders().containsKey("recipient")
424
- && (boolean) m.getHeaders().get("recipient"))
425
- .recipientFlow("'thing1' == payload or 'thing2' == payload or 'thing3' == payload",
426
- f -> f.<String, String>transform(String::toUpperCase)
427
- .channel(c -> c.queue("recipientListSubFlow1Result")))
428
- .recipientFlow((String p) -> p.startsWith("thing3"),
429
- f -> f.transform("Hello "::concat)
430
- .channel(c -> c.queue("recipientListSubFlow2Result")))
431
- .recipientFlow(new FunctionExpression<Message<?>>(m ->
432
- "thing3".equals(m.getPayload())),
433
- f -> f.channel(c -> c.queue("recipientListSubFlow3Result")))
434
- .defaultOutputToParentFlow())
420
+ .routeToRecipients(r -> r
421
+ .recipient("thing1-channel", "'thing1' == payload")
422
+ .recipientMessageSelector ("thing2-channel", m ->
423
+ m.getHeaders().containsKey("recipient")
424
+ && (boolean) m.getHeaders().get("recipient"))
425
+ .recipientFlow("'thing1' == payload or 'thing2' == payload or 'thing3' == payload",
426
+ f -> f.<String, String>transform(String::toUpperCase)
427
+ .channel(c -> c.queue("recipientListSubFlow1Result")))
428
+ .recipientFlow((String p) -> p.startsWith("thing3"),
429
+ f -> f.transform("Hello "::concat)
430
+ .channel(c -> c.queue("recipientListSubFlow2Result")))
431
+ .recipientFlow(new FunctionExpression<Message<?>>(m ->
432
+ "thing3".equals(m.getPayload())),
433
+ f -> f.channel(c -> c.queue("recipientListSubFlow3Result")))
434
+ .defaultOutputToParentFlow())
435
435
.get();
436
436
}
437
437
----
0 commit comments