Documentation ¶
Overview ¶
Package memory provides an in-memory pubsub mechanism. Its usage is recommended when operating a monolith, an actual pubsub engine has not yet been chosen or when working on POCs and the like.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPublisher ¶
func NewPublisher(opts ...PublisherOption) pubsub.Publisher
NewPublisher creates a new in memory publisher implementation.
func NewSubscriber ¶
func NewSubscriber(opts ...SubscriberOption) pubsub.Subscriber
NewSubscriber creates a new in memory subscriber implementation.
Types ¶
type PublisherOption ¶
type PublisherOption func(*publisher)
PublisherOption allows to tweak publisher behavior while hidding the library internals.
func WithPublisherID ¶ added in v2.2.0
func WithPublisherID(id string) PublisherOption
WithPublisherID indicates the publisher identifier for traceability purposes.
type SubscriberOption ¶
type SubscriberOption func(*subscriber)
SubscriberOption allows to tweak subscriber behavior while hidding the library internals.
func WithMaxAttempts ¶
func WithMaxAttempts(retries int) SubscriberOption
WithMaxAttempts indicates how many times an event will be processed if the handler erroes. Defaults to 1.
func WithQueueSize ¶
func WithQueueSize(queueSize int) SubscriberOption
WithQueueSize indicates how many events can be in flight at any given time. Defaults to 10.
func WithSubscriberID ¶ added in v2.2.0
func WithSubscriberID(id string) SubscriberOption
WithSubscriberID indicates the consumer identifier for traceability purposes.