ConsumerRegistry class

Registers consumers and gives each message the same treatment a request gets.

A hand-rolled consumer sits outside everything the framework provides: no per-message dependency scope, no correlation, and no part in shutdown — so a deploy drains HTTP properly while the consumer keeps pulling work and is killed mid-message. This closes all three.

Constructors

ConsumerRegistry({required MessageBroker broker, DI? di})

Properties

broker MessageBroker
final
di DI?
The application container each message scopes from, when there is one.
final
hashCode int
The hash code for this object.
no setterinherited
inFlight int
Messages currently being handled.
no setter
isDraining bool
Whether a shutdown has begun. Readiness-style checks can consult it.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
subscriptions int
no setter

Methods

close() Future<void>
Cancels every subscription and closes the broker.
consume(String topic, {required String group, required MessageHandler onMessage}) Future<void>
Subscribes onMessage to topic.
drain(Duration timeout) Future<bool>
Stops taking new messages and waits for those in hand, up to timeout.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited