@@ -0,0 +1,40 @@
|
||||
=== Communicating with a Machine
|
||||
We've added new reactive methods to `StateMachine` while still keeping old blocking event
|
||||
methods in place.
|
||||
|
||||
====
|
||||
[source,java,indent=0]
|
||||
----
|
||||
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`.
|
||||
|
||||
====
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/DocsMigrationTests.java[tags=snippetB1]
|
||||
----
|
||||
====
|
||||
|
||||
You can also send a `Flux` of messages instead of a single `Mono` message.
|
||||
|
||||
====
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/DocsMigrationTests.java[tags=snippetB2]
|
||||
----
|
||||
====
|
||||
|
||||
All of the reactor methods are on your disposal and for example not to block and
|
||||
do something when event handling is completed, you could do something like.
|
||||
|
||||
====
|
||||
[source,java,indent=0]
|
||||
----
|
||||
include::samples/DocsMigrationTests.java[tags=snippetB3]
|
||||
----
|
||||
====
|
||||
@@ -1,9 +1,10 @@
|
||||
[appendix]
|
||||
[[appendix-reactormigrationguide]]
|
||||
== Reactor Migration Guide
|
||||
|
||||
Main task for a work for `3.x` has been to both internally and externally to move and change
|
||||
as much as we can from imperative code into a reactive world. This means that some
|
||||
of a main interfaces has added a new reative methods and most of a internal execution locig
|
||||
has been moved over to handled by a reactor. Essentially what this means is that thread handling
|
||||
is considerably different compared to `2.x`. Following chapters go throught all these changes.
|
||||
|
||||
include::appendix-reactormigration-communicating.adoc[]
|
||||
|
||||
Reference in New Issue
Block a user