=== 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`. More about
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]
----
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]
----
====

Old API methods returning a `boolean` for accepted status are still in place
but are deprecated to get removed in future releases.

====
[source,java,indent=0]
----
include::samples/DocsMigrationTests.java[tags=snippetB4]
----
====
