distributed-process-execution- Execution Framework for The Cloud Haskell Application Platform

Copyright(c) Well-Typed / Tim Watson
LicenseBSD3 (see the file LICENSE)
MaintainerTim Watson <watson.timothy@gmail.com>
Portabilitynon-portable (requires concurrency)
Safe HaskellNone




The EventManager is a parallel/concurrent event handling tool, built on top of the Exchange API. Arbitrary events are published to the event manager using notify, and are broadcast simulataneously to a set of registered event handlers.

Defining and Registering Event Handlers

Event handlers are defined as Serializable m => s -> m -> Process s, i.e., an expression taking an initial state, an arbitrary Serializable event/message and performing an action in the Process monad that evaluates to a new state.

See Control.Distributed.Process.Execution.Exchange.



start :: Process EventManager Source

Start a new Event Manager process and return an opaque handle to it.

notify :: Serializable a => EventManager -> a -> Process () Source

Broadcast an event to all registered handlers.

addHandler :: forall s a. Serializable a => EventManager -> (s -> a -> Process s) -> Process s -> Process ProcessId Source

Add a new event handler. The handler runs in its own process, which is spawned locally on behalf of the caller.

addMessageHandler :: forall s. EventManager -> (s -> Message -> Process (Maybe s)) -> Process s -> Process ProcessId Source

As addHandler, but operates over a raw Control.Distributed.Process.Message.