## protocols.eventsub.EventSubscriberProtocol

<span id="hexkit.protocols.eventsub.EventSubscriberProtocol"></span>


A protocol for consuming events from an event broker.


Usage

``` python
protocols.eventsub.EventSubscriberProtocol()
```


In addition to the methods described below, implementations shall expose the the following attributes: topics_of_interest (list\[str\]): A list of topics of interest to which the provider shall subscribe. types_of_interest (list\[str\]): A list of event types of interest. Out of the events arriving in the topics of interest, the provider shall only pass events of these types down to the protocol. Events of other types shall be filtered out.


## Classes

| Name | Description |
|----|----|
| [MalformedPayloadError](#MalformedPayloadError) | Raised if the payload of a received event was not formatted as expected given |

<span id="MalformedPayloadError"></span>

<span id="hexkit.protocols.eventsub.EventSubscriberProtocol.MalformedPayloadError"></span>


#### MalformedPayloadError


Raised if the payload of a received event was not formatted as expected given


Usage

``` python
MalformedPayloadError()
```


the type.


## Methods

| Name | Description |
|----|----|
| [consume()](#consume) | Receive an event of interest and process it according to its type. |

<span id="hexkit.protocols.eventsub.EventSubscriberProtocol.consume"></span>


#### consume()


Receive an event of interest and process it according to its type.


Usage

``` python
consume(*, payload, type_, topic, key, event_id)
```


##### Parameters


`payload: JsonObject`  
The data/payload to send with the event.

`type_: Ascii`  
The type of the event.

`topic: Ascii`  
Name of the topic the event was published to.

`key: Ascii`  
A key used for routing the event.

`event_id: UUID4`  
The unique identifier of the event.
