proxy.core.event.queue module#
proxy.py#
⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.
- copyright
2013-present by Abhinav Singh and contributors.
- license
BSD, see LICENSE for more details.
- class proxy.core.event.queue.EventQueue(queue: queue.Queue)[source]#
Bases:
object
Global event queue. Must be a multiprocess safe queue capable of transporting other queues. This is necessary because currently subscribers use a separate subscription queue to consume events. Subscription queue is exchanged over the global event queue.
Each published event contains following schema:
{ 'request_id': 'Globally unique request ID', 'process_id': 'Process ID of event publisher. This ' 'will be the process ID of acceptor workers.', 'thread_id': 'Thread ID of event publisher. ' 'When --threadless is enabled, this value ' 'will be same for all the requests.' 'event_timestamp': 'Time when this event occured', 'event_name': 'one of the pre-defined or custom event name', 'event_payload': 'Optional data associated with the event', 'publisher_id': 'Optional publisher entity unique name', }
- publish(request_id: str, event_name: int, event_payload: Dict[str, Any], publisher_id: Optional[str] = None) None [source]#
- subscribe(sub_id: str, channel: multiprocessing.connection.Connection) None [source]#
Subscribe to global events.
sub_id is a subscription identifier which must be globally unique. channel MUST be a multiprocessing connection.