bobocep.cep.action.handler.BoboActionHandlerMultithreading

class bobocep.cep.action.handler.BoboActionHandlerMultithreading(threads: int, max_size: int = 0)[source]

Bases: bobocep.cep.action.handler.BoboActionHandler

An action handler that uses multithreading for action execution.

__init__(threads: int, max_size: int = 0)[source]
Parameters
  • threads – Number of thread processes to use for handling actions.

  • max_size – Maximum queue size. Default: 0 (unbounded).

close() None

Close the handler.

get_handler_response() Optional[bobocep.cep.action.handler.BoboHandlerResponse]
Returns

Action response from queue, or None if queue is empty.

handle(action: bobocep.cep.action.action.BoboAction, event: bobocep.cep.event.complex.BoboEventComplex) Any

Handle an action.

Parameters
  • action – The action to handle.

  • event – The complex event that caused the action to trigger.

Returns

A return value from handling the action.

is_closed() bool
Returns

True if handler is closed; False otherwise.

join() None[source]

Join the multiprocessing pool.

size() int
Returns

The size of the handler queue.