JoobQ::EventBus
Inherits Reference < Object
Delivers events to sinks from a dedicated fiber, so emitting never blocks or fails the caller. When the buffer is full the event is dropped and counted.
Constants
BATCH_SIZE = 100
ERROR_LOG_INTERVAL = 10.seconds
Log = ::Log.for("EVENTS")
Constructors
new(capacity : Int32 = 4096)
SourceInstance methods
active?
Sourceclose(wait : Time::Span = 2.seconds) : Nil
Stops accepting events, delivers what is buffered, and waits for the
dispatcher to finish (up to wait).
dropped
Sourceemit(type : String, & : -> _) : Nil
The block builds the payload and only runs when someone is listening.
subscribe(sink : EventSink) : Nil
Sourceunsubscribe(sink : EventSink) : Nil
Source