inproc

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package inproc provides an in-process event bus for maniflex. Events are delivered to subscribers via a bounded worker pool whose size is controlled by Subscription.Concurrency. There is no persistence: events published before a subscription is registered, or while the process is down, are lost.

Use inproc for tests and single-binary deployments. For durability pair with events/outbox.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus struct {
	// contains filtered or unexported fields
}

Bus is an in-process fan-out event bus.

func New

func New() *Bus

New creates an in-process Bus.

func (*Bus) Close

func (b *Bus) Close() error

Close is a no-op; in-process subscriptions are cancelled via their Cancel func.

func (*Bus) Publish

func (b *Bus) Publish(_ context.Context, e events.Event) error

Publish delivers e to all matching subscribers. Each delivery acquires a slot from the subscription's semaphore before calling DeliverWithRetry, so at most Concurrency handlers run concurrently per subscription.

func (*Bus) PublishBatch

func (b *Bus) PublishBatch(ctx context.Context, es []events.Event) error

PublishBatch publishes each event in es. Each delivery is independent.

func (*Bus) Subscribe

func (b *Bus) Subscribe(_ context.Context, sub events.Subscription) (events.Cancel, error)

Subscribe registers sub and returns a Cancel function to remove it. The returned Cancel is safe to call more than once.

Jump to

Keyboard shortcuts

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