proxy.core.event.dispatcher module#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

  1. 2013-present by Abhinav Singh and contributors.


BSD, see LICENSE for more details.

class proxy.core.event.dispatcher.EventDispatcher(shutdown: threading.Event, event_queue: proxy.core.event.queue.EventQueue)[source]#

Bases: object

Core EventDispatcher.

Direct consuming from global events queue outside of dispatcher module is not-recommended. Python native multiprocessing queue doesn’t provide a fanout functionality which core dispatcher module implements so that several plugins can consume the same published event concurrently (when necessary).

When –enable-events is used, a multiprocessing.Queue is created and attached to global flags. This queue can then be used for dispatching an Event dict object into the queue.

When –enable-events is used, dispatcher module is automatically started. Most importantly, dispatcher module ensures that queue is not flooded and doesn’t utilize too much memory in case there are no event subscribers for published messages.

EventDispatcher ensures that subscribers will receive the messages in the order they are published.

_broadcast(ev: Dict[str, Any]) None[source]#
_close(sub_id: str) None[source]#
_close_and_delete(sub_id: str) None[source]#
_send(sub_id: str, payload: Any) bool[source]#
handle_event(ev: Dict[str, Any]) None[source]#
run() None[source]#
run_once() None[source]#