Documentation
¶
Overview ¶
Package memory provides an in-process messaging backend for no-infra builds and tests.
A Broker holds one buffered channel per topic; a Publisher and Subscriber connect only when handed the SAME broker instance (not package-global state), so two separate brokers are fully isolated. Mirrors the Python messaging/memory backend. Selected by the messaging tier Kind.
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 message broker: a lazily-created buffered channel per topic.
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher enqueues messages onto a Broker instead of SQS (dev/test; no external broker).
func NewPublisher ¶
NewPublisher publishes onto broker; a Subscriber built from the same broker receives the messages.
type Subscriber ¶
type Subscriber struct {
// contains filtered or unexported fields
}
Subscriber consumes messages from a Broker instead of SQS (dev/test; no external broker).
func NewSubscriber ¶
func NewSubscriber(broker *Broker, handlers client.Base) *Subscriber
NewSubscriber consumes from broker, running each handler call through handlers (the zero Base runs them undecorated); a Publisher built from the same broker feeds this subscriber.
func (*Subscriber) Close ¶
func (s *Subscriber) Close() error
Close stops the receive loop (idempotent).
func (*Subscriber) Subscribe ¶
func (s *Subscriber) Subscribe( ctx context.Context, topic string, handler interfaces.MessageHandler, ) error
Subscribe delivers each message on topic to handler until Close is called or ctx is cancelled. A handler error is dropped: the in-memory broker has no redelivery, so this is a stub's best effort — good enough to exercise the consume path with no SQS, not to model at-least-once.