Closed IlyaSkriblovsky closed 8 years ago
Basically you create a Notifier
object with a scope.notifier()
. This is the object that may be used to wakeup a state machine (in context of which you have called scope). Then you must put it either to a shared location or to another state machine directly.
When you have a notifier, you can call wakeup()
on it, and the wakeup
method of the corresponding state machine will be called on the next loop iteration.
Let me illustrate with some code. Here we crate a state machine for a connection, and put a notifier of it to a shared location (A Schedule
object). Then we can tweak settings in a shared state, which notifies connection's state machine. That in turn ends up in this wakeup code, and determines when to start a next http request.
Let me know if you need more help.
Thanks, I will study your code
Sorry in advance if I'm asking a dumb question.
How it will look like if I need to query database to serve HTTP request by rotor-based HTTP server (supposing we have rotor-based DB driver)? I've studies all the examples and most of API docs, but still can't figure out what is the right way to defer some work to another protocol and be notified asynchronously when it is done (possibly with some response payload).