PingPong.Dispatcher (PingPong v0.1.0)

Copy Markdown View Source

Dispatches notifications to registered service modules.

The dispatcher resolves a service key through PingPong.Registry and calls the service's call/2 function. It is the boundary between the public API and service implementations.

Summary

Functions

Dispatches a notification synchronously.

Dispatches a notification in a supervised task.

Functions

dispatch(service, payload, options)

Dispatches a notification synchronously.

Returns {:error, {:unknown_service, service}} when no service module is registered for the given key.

dispatch_async(service, payload, options)

Dispatches a notification in a supervised task.

Returns {:ok, task} when the service is known. Awaiting the task returns the selected service's result.