NoopEventPublisher¶
- class safir.metrics.NoopEventPublisher(application, event_class, logger)¶
Bases:
EventPublisher
,Generic
[P
]Event publisher that quietly does nothing.
This is used in applications when event publishing is disabled, so that the parsing and conversion of the events is still tested (thus making application tests meaningful), but the event is not sent anywhere.
- Parameters:
application (
str
)event_class (
type
[TypeVar
(P
, bound=EventPayload
)])logger (
BoundLogger
)
Methods Summary
publish
(payload)Publish an event payload.
Methods Documentation
- async publish(payload)¶
Publish an event payload.
- Parameters:
payload (
TypeVar
(P
, bound=EventPayload
)) – Payload to publish.- Returns:
Full, enriched-with-metadata event model that was published. This will be an object of a class derived from both the type of the payload and
EventMetadata
, but it is typed as the latter since that is the newly-added information that may be of interest to the caller and therefore the most likely to be accessed.- Return type: