diff --git a/README.adoc b/README.adoc index 171a44439..733d04a63 100644 --- a/README.adoc +++ b/README.adoc @@ -159,7 +159,7 @@ You should see following output: Go to the RabbitMQ management console or any other RabbitMQ client and send a message to `input.anonymous.CbMIwdkJSBO1ZoPDOtHtCg`. The `anonymous.CbMIwdkJSBO1ZoPDOtHtCg` part represents the group name and is generated, so it is bound to be different in your environment. -For something more predictable, you can use an explicit group name by setting `spring.cloud.stream.bindings.log-in-0.group=hello` (or whatever name you like). +For something more predictable, you can use an explicit group name by setting `spring.cloud.stream.bindings.input.group=hello` (or whatever name you like). The contents of the message should be a JSON representation of the `Person` class, as follows: @@ -329,4 +329,4 @@ added after the original pull request but before a merge. message (where XXXX is the issue number). -// ====================================================================================== +// ====================================================================================== \ No newline at end of file diff --git a/docs/src/main/asciidoc/spring-cloud-stream.adoc b/docs/src/main/asciidoc/spring-cloud-stream.adoc index 9740a9a8a..322735b2c 100644 --- a/docs/src/main/asciidoc/spring-cloud-stream.adoc +++ b/docs/src/main/asciidoc/spring-cloud-stream.adoc @@ -425,7 +425,12 @@ Since Spring Cloud Stream v2.1, another alternative for defining _stream handler support for https://cloud.spring.io/spring-cloud-function/[Spring Cloud Function] where they can be expressed as beans of type `java.util.function.[Supplier/Function/Consumer]`. -To specify which functional bean to bind to the external destination(s) exposed by the bindings, you must provide `spring.cloud.function.definition` property. +To specify which functional bean to bind to the external destination(s) exposed by the bindings, +you must provide `spring.cloud.function.definition` property. + +NOTE: In the event you only have single bean of type `java.util.function.[Supplier/Function/Consumer]`, you can +skip the `spring.cloud.function.definition` property, since such functional bean will be auto-discovered. However, +it is considered best practice to use such property to avoid any confusion. Here is the example of the application exposing message handler as `java.util.function.Function` effectively supporting _pass-thru_ semantics by acting as consumer and producer of data. @@ -444,8 +449,10 @@ public class MyFunctionBootApp { } } ---- -In the above you we simply define a bean of type `java.util.function.Function` called _toUpperCase_ and identify it as a bean to be used as message handler +In the preceding example, we define a bean of type `java.util.function.Function` called _toUpperCase_ to be acting as message handler whose 'input' and 'output' must be bound to the external destinations exposed by the provided destination binder. +By default the 'input' and 'output' binding names will be `toUpperCase-in-0` and `toUpperCase-out-0`. +Please see <> section for details on naming convention used to establish binding names. Below are the examples of simple functional applications to support other semantics: @@ -475,10 +482,6 @@ public static class SinkFromConsumer { } ---- -NOTE: We are using `--spring.cloud.function.definition` property to explicitly declare which function bean -we want to be bound to binding destinations. For cases when you only have single such bean it is not required -but for all other cases it is. - ===== Suppliers (Sources) `Function` and `Consumer` are pretty straightforward when it comes to how their invocation is triggered. They are triggered based