Event Dispatcher

class ska_csp_lmc_common.event.CspEventRegistry(logger)

Bases: object

Dispatcher for attribute-based event routing.

This class is responsible only for routing events to the appropriate handler based on attribute name. It does not implement any domain logic itself.

__init__(logger)

Initialise the CspEventRegistry.

Parameters:

logger – logger instance used for debug messages

HandlerType

alias of Callable[[…], None]

register(attr_name: str, handler: Callable, *, skip_default: bool = False)

Register a handler for an attribute, with optional skip_default flag.

Parameters:
  • attr_name – Name of the attribute to register the handler for.

  • handler – Callable that will be invoked when an event for this attribute occurs. Should accept a single argument: the event.

  • skip_default – If True, events for this attribute will bypass the default handler.

handlers_for(attr_name: str) Callable

Return handlers registered for an attribute.

Parameters:

attr_name – Name of the attribute.

Returns:

The handler callable(s) if found, otherwise None.

clear_all()

Remove all registered handlers and reset skip_default attributes.

Clears both the handler mapping and the set of attributes for which the default handler should be skipped.