Skip to content

Commit b62c2a8

Browse files
mamachankoartembilan
authored andcommitted
Update docs for message routers so that they compile
1 parent f15a4c4 commit b62c2a8

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

src/reference/asciidoc/dsl.adoc

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ The fluent API also provides `AbstractMappingMessageRouter` options such as `cha
382382
[source,java]
383383
----
384384
@Bean
385-
public IntegrationFlow routeFlow() {
385+
public IntegrationFlow routeFlowByLambda() {
386386
return IntegrationFlows.from("routerInput")
387387
.<Integer, Boolean>route(p -> p % 2 == 0,
388388
m -> m.suffix("Channel")
389-
.channelMapping("true", "even")
390-
.channelMapping("false", "odd")
389+
.channelMapping(true, "even")
390+
.channelMapping(false, "odd")
391391
)
392392
.get();
393393
}
@@ -400,7 +400,7 @@ The following example shows a simple expression-based router:
400400
[source,java]
401401
----
402402
@Bean
403-
public IntegrationFlow routeFlow() {
403+
public IntegrationFlow routeFlowByExpression() {
404404
return IntegrationFlows.from("routerInput")
405405
.route("headers['destChannel']")
406406
.get();
@@ -417,21 +417,21 @@ The `routeToRecipients()` method takes a `Consumer<RecipientListRouterSpec>`, as
417417
public IntegrationFlow recipientListFlow() {
418418
return IntegrationFlows.from("recipientListInput")
419419
.<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())
435435
.get();
436436
}
437437
----

0 commit comments

Comments
 (0)