Polish documentation

This commit is contained in:
Oleg Zhurakousky
2021-03-03 07:59:10 +01:00
parent 8ecf72c50e
commit 0a28d57da3

View File

@@ -68,8 +68,8 @@ By now you shoudl be familiar with the standard function composition feature (e.
With RSocket and our _distributed function composition_ feature you can still do it. So let's look at the example.
Let's say we have `uppercase` function available to you locally and `reverse` function exposed via separate RSocket and you wan to compose `uppercase` and `reverse` into a single function. Had they been both available locally it would have ben as simple as `uppercase|reverse`, but given that `reverse` function is not locally available we need a way to specify in our composition instruction the fact that we want to compose with a remote function. For that we're using _redirect_ operator to specify our composition instruction. So it woudl look ike this `uppercase>localhost:2222`, where `localhost:2222` is the host/port combination where `reverse` function is running.
What's interesting is that remote function can in itself be a result of function composition (local or remote), so effectively you are composing `uppercase` with function definition (which could be composition) that is running on `localhost:2222`.
Let's say we have `uppercase` function available to you locally and `reverse` function exposed via separate RSocket and you wan to compose `uppercase` and `reverse` into a single function. Had they been both available locally it would have been as simple as `uppercase|reverse`, but given that `reverse` function is not locally available we need a way to specify that in our composition instruction. For that we're using _redirect_ operator. So it woudl look like this `uppercase>localhost:2222`, where `localhost:2222` is the host/port combination where `reverse` function is hosted.
What's interesting is that remote function can in itself be a result of function composition (local or remote), so effectively you are composing `uppercase` with whatever function definition (which could be composition) that is running on `localhost:2222`.
The complete example is available in [this test case](https://github.com/spring-cloud/spring-cloud-function/blob/0e3a27a392f5c69727d909db26c2ba6aa0344cfd/spring-cloud-function-rsocket/src/test/java/org/springframework/cloud/function/rsocket/RSocketAutoConfigurationTests.java#L371). And as you can see it is a bit more complex to showcase thi feature. In this test we are composing `reverse` function with `uppercase|concat` running remotely and then with `wrap` function running locally as if `reverse|uppercase|concat|wrap`.
So you can see `--spring.cloud.function.definition=reverse>localhost:" + portA + "|wrap"` where `localhost:" + portA` points to another application context instance with `--spring.cloud.function.definition=uppercase|concat`. The result of the `reverse` function are sent to `uppercase|concat` function via RSocket and the result of that are fed into `wrap` function.