PostgresBroker class
PostgreSQL-backed implementation of Broker.
Properties
- deadLetterRetention → Duration
-
Retention window for dead letter records.
final
- defaultVisibilityTimeout → Duration
-
Default visibility timeout applied to deliveries.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- namespace → String
-
Namespace used to scope broker data.
final
- pollInterval → Duration
-
Poll interval used while waiting for jobs.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- supportsDelayed → bool
-
Whether this broker supports delayed message delivery.
no setter
- supportsPriority → bool
-
Whether this broker supports message priorities.
no setter
- sweeperInterval → Duration
-
Interval used to sweep for expired locks.
final
Methods
-
ack(
Delivery delivery) → Future< void> -
Acknowledges the
delivery, confirming successful processing. -
close(
) → Future< void> - Closes the broker and releases any database resources.
-
consume(
RoutingSubscription subscription, {int prefetch = 1, String? consumerGroup, String? consumerName}) → Stream< Delivery> -
Returns a stream of deliveries based on the supplied
subscription. -
deadLetter(
Delivery delivery, {String? reason, Map< String, Object?> ? meta}) → Future<void> -
Sends the
deliveryto the dead letter queue. -
extendLease(
Delivery delivery, Duration by) → Future< void> -
Extends the lease for the
deliveryby thebyduration. -
getDeadLetter(
String queue, String id) → Future< DeadLetterEntry?> -
Retrieves a single dead letter entry by envelope
id, ornullif not found. -
inflightCount(
String queue) → Future< int?> -
Returns the number of in-flight messages for
queue, if supported. -
listDeadLetters(
String queue, {int limit = 50, int offset = 0}) → Future< DeadLetterPage> -
Lists dead letter queue entries for
queue, returning up tolimitresults starting atoffset. Entries are typically ordered from newest to oldest unless documented otherwise by the implementation. -
nack(
Delivery delivery, {bool requeue = true}) → Future< void> -
Negatively acknowledges the
delivery. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pendingCount(
String queue) → Future< int?> -
Returns the number of pending messages for
queue, if supported. -
publish(
Envelope envelope, {RoutingInfo? routing}) → Future< void> -
Publishes the given
envelopeusingroutingmetadata when provided. -
purge(
String queue) → Future< void> -
Removes all messages from the
queue. -
purgeDeadLetters(
String queue, {DateTime? since, int? limit}) → Future< int> -
Removes dead letter entries from
queue. -
replayDeadLetters(
String queue, {int limit = 50, DateTime? since, Duration? delay, bool dryRun = false}) → Future< DeadLetterReplayResult> -
Replays at most
limitdead letter entries back onto the active queue. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
connect(
String connectionString, {String namespace = 'stem', Duration defaultVisibilityTimeout = const Duration(seconds: 30), Duration pollInterval = const Duration(milliseconds: 500), Duration sweeperInterval = const Duration(seconds: 10), Duration deadLetterRetention = const Duration(days: 7), String? applicationName, TlsConfig? tls}) → Future< PostgresBroker> - Connects to PostgreSQL and returns a broker instance.
-
fromDataSource(
DataSource dataSource, {String namespace = 'stem', Duration defaultVisibilityTimeout = const Duration(seconds: 30), Duration pollInterval = const Duration(milliseconds: 500), Duration sweeperInterval = const Duration(seconds: 10), Duration deadLetterRetention = const Duration(days: 7)}) → PostgresBroker -
Creates a broker using an existing
DataSource.