Add api sugar for mono gets mono

- While this doesn't change underlying behaviour, add sendEventCollect
  method which takes a mono and returns a mono as list of results.
- Add some notes to docs why this is like this, aka having regions
  returns multiple results.
- Fixes #922
This commit is contained in:
Janne Valkealahti
2021-03-13 15:32:16 +00:00
parent adce03c2e4
commit 341d57e48f
11 changed files with 103 additions and 8 deletions

View File

@@ -12,7 +12,9 @@ include::samples/DocsMigrationTests.java[tags=snippetA]
We're now solely working on a spring `Message` and reactor `Mono` and `Flux` classes.
You can send a `Mono` of a `Message` and receive back a `Flux` of `StateMachineEventResult`.
Remember that nothing happens until you subscribe to this `Flux`. More about
this returned value, see <<sm-triggers-statemachineeventresult>>.
this returned value, see <<sm-triggers-statemachineeventresult>>. Method `sendEventCollect`
is just a syntactic sugar to pass in a `Mono` and get a `Mono` which wraps
results as a list.
====
[source,java,indent=0]

View File

@@ -20,6 +20,20 @@ include::samples/DocsConfigurationSampleTests.java[tags=snippetO]
----
====
Whether you send one event or multiple events, result is always a sequence
of results. This is so because in a presence multiple reqions, results will
come back from multiple machines in those regions. This is shown
with method `sendEventCollect` which gives a list of results. Method
itself is a just a syntactic sugar collecting `Flux` as list. If there is
just one region, this list contains one result.
====
[source,java,indent=0]
----
include::samples/DocsConfigurationSampleTests.java[tags=snippetO3]
----
====
IMPORTANT: Nothing happens until returned flux is subscribed. See more about it from
<<sm-triggers-statemachineeventresult>>.