# `Handler`

### *class* capymoa.ocl.events.Handler[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/events.py#L58)

Bases: [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC)

Abstract interface for components that consume events.

A sink encapsulates subscription logic and can attach itself to an
[`Dispatcher`](capymoa.ocl.events.Dispatcher.md#capymoa.ocl.events.Dispatcher).

Subclass `Handler` and implement [`attach_with()`](#capymoa.ocl.events.Handler.attach_with) to register
the sink’s handlers with a source.

#### *abstract* attach_with(dispatcher: [Dispatcher](capymoa.ocl.events.Dispatcher.md#capymoa.ocl.events.Dispatcher)) → [Handler](#capymoa.ocl.events.Handler)[[source]](https://github.com/adaptive-machine-learning/CapyMOA/blob/3e255b1/src/capymoa/ocl/events.py#L68)

Attach this sink to an event source.

Implementations should call
[`capymoa.ocl.events.Dispatcher.subscribe()`](capymoa.ocl.events.Dispatcher.md#capymoa.ocl.events.Dispatcher.subscribe) for each
event type the sink needs to handle.

* **Parameters:**
  **dispatcher** – The source this sink should subscribe to.
