EndpointEventListener
Receives EndpointEvents. Called synchronously on the endpoint's coroutines, outside its locks, so it must be quick and must not throw; exceptions are caught and logged. Hand the work to a queue or count with atomics; for several listeners, combine them with plus.
val listener = EndpointEventListener { event -> if (event is EndpointEvent.RequestCompleted) metrics.record(event) } +
EndpointEventListener { event -> if (event is EndpointEvent.LimitReached) alerts.raise(event.limit) }Content copied to clipboard
Functions
Link copied to clipboard
Called for every event.
Link copied to clipboard
Sends each event to this listener and then to other, as LogSink.plus does for log records. A listener that throws does not keep the event from the others: each is called, and the first exception is thrown afterwards, for the endpoint to log. EndpointEventListener.None adds nothing.