You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/main/asciidoc/spring-cloud-function.adoc
+54-2Lines changed: 54 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -145,7 +145,7 @@ public class RoutingFunction implements Function<Object, Object> {
145
145
The routing instructions could be communicated in several ways. We support providing instructions via Message headers, System
146
146
properties as well as pluggable strategy. So let's look at some of the details
147
147
148
-
*MessageRoutingCallback*
148
+
==== MessageRoutingCallback
149
149
150
150
The `MessageRoutingCallback` is a strategy to assist with determining the name of the route-to function definition.
151
151
@@ -231,7 +231,7 @@ conflict resolutions in the event multiple mechanisms are used at the same time,
231
231
3. Application Properties (Any function)
232
232
233
233
234
-
*Function Filtering*
234
+
==== Function Filtering
235
235
Filtering is the type of routing where there are only two paths - 'go' or 'discard'. In terms of functions it mean
236
236
you only want to invoke a certain function if some condition returns 'true', otherwise you want to discard input.
237
237
However, when it comes to discarding input there are many interpretation of what it could mean in the context of your application.
@@ -261,6 +261,58 @@ due to the nature of the reactive functions which are invoked only once to pass
261
261
is handled by the reactor, hence we can not access and/or rely on the routing instructions communicated via individual
262
262
values (e.g., Message).
263
263
264
+
==== Multiple Routers
265
+
266
+
By default the framework will always have a single routing function configured as described in previous sections. However, there are times when you may need more then one routing function.
267
+
In that case you can create your own instance of the `RoutingFunction` bean in addition to the existing one as long as you give it a name other than `functionRouter`.
268
+
269
+
You can pass `spring.cloud.function.routing-expression` or `spring.cloud.function.definition` to RoutinFunction as key/value pairs in the map.
270
+
271
+
Here is a simple example
272
+
273
+
----
274
+
@Configuration
275
+
protected static class MultipleRouterConfiguration {
There are often times when you need to modify or refine an incoming or outgoing Message and to keep your code clean of non-functional concerns. You don’t want to do it inside of your business logic.
Copy file name to clipboardExpand all lines: spring-cloud-function-context/src/main/java/org/springframework/cloud/function/context/config/RoutingFunction.java
Copy file name to clipboardExpand all lines: spring-cloud-function-context/src/test/java/org/springframework/cloud/function/context/config/RoutingFunctionTests.java
0 commit comments