Documentation
¶
Overview ¶
Package memory is the in-process pubsub.Broker used for single-instance deployments, development and tests.
Publish copies the payload once and queues it for every matching subscription; each subscription has its own goroutine and bounded queue, so handlers run sequentially per subscription and a slow handler never blocks publishers (overflowing messages are dropped with a warning).
Brokers created with NewPeer share one in-process bus, which simulates several server instances connected to the same backend: a message published on any peer is delivered to the subscribers of every open peer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker struct {
// contains filtered or unexported fields
}
Broker is an in-process pubsub.Broker. The zero value is not usable; call New.
func (*Broker) Close ¶
Close detaches the broker from its bus and stops all of its subscriptions. It is idempotent.
func (*Broker) NewPeer ¶
NewPeer returns another broker attached to the same bus as b, as if it were a second server instance sharing b's backend. It inherits b's options. Closing one peer does not affect the others.
type Option ¶
Option configures a Broker.
func WithLogger ¶
WithLogger sets the logger used for overflow warnings and handler panics.
func WithQueueLimits ¶
WithQueueLimits bounds the undelivered messages (count and bytes) kept per subscription. Non-positive values keep the defaults (10000 messages, 64 MiB).