Update docs for message routers so that they compile
This commit is contained in:
@@ -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")
|
||||
.<Integer, Boolean>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<RecipientListRouterSpec>`, as
|
||||
public IntegrationFlow recipientListFlow() {
|
||||
return IntegrationFlows.from("recipientListInput")
|
||||
.<String, String>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.<String, String>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<Message<?>>(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.<String, String>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<Message<?>>(m ->
|
||||
"thing3".equals(m.getPayload())),
|
||||
f -> f.channel(c -> c.queue("recipientListSubFlow3Result")))
|
||||
.defaultOutputToParentFlow())
|
||||
.get();
|
||||
}
|
||||
----
|
||||
|
||||
Reference in New Issue
Block a user