membroker

package
v0.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package membroker provides an in-memory broker adapter for runtime/contracts.

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 stores published events in memory and exposes them as worker batches. It is intended for tests, local development, and single-process apps.

func New

func New(options ...Option) *Broker

New creates an in-memory broker.

func (*Broker) Len

func (broker *Broker) Len() int

Len returns the queued event count.

func (*Broker) PublishEvents

func (broker *Broker) PublishEvents(ctx context.Context, events []contracts.EventEnvelope) error

PublishEvents appends events to the broker queue.

func (*Broker) ReceiveEventBatch

func (broker *Broker) ReceiveEventBatch(ctx context.Context) (contracts.EventBatch, error)

ReceiveEventBatch returns the next queued batch. Ack removes the delivered records; Nack leaves them queued for retry.

type Option

type Option func(*Broker)

Option configures a Broker.

func WithBatchSize

func WithBatchSize(size int) Option

WithBatchSize sets the maximum events returned by one worker batch.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL