bus

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewChannelBus

func NewChannelBus(bufSize int) (*ChannelProducer, *ChannelConsumer)

Types

type ChannelConsumer

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

ChannelConsumer is an in-process Consumer backed by a Go channel.

func (*ChannelConsumer) Close

func (c *ChannelConsumer) Close() error

func (*ChannelConsumer) Listen

func (c *ChannelConsumer) Listen(ctx context.Context, handler func(ctx context.Context, data []byte) error) error

type ChannelProducer

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

ChannelProducer is an in-process Producer backed by a Go channel.

func (*ChannelProducer) Close

func (p *ChannelProducer) Close() error

func (*ChannelProducer) Publish

func (p *ChannelProducer) Publish(_ context.Context, data []byte) error

type Consumer

type Consumer interface {
	Listen(ctx context.Context, handler func(ctx context.Context, data []byte) error) error
	Close() error
}

Consumer receives messages from a topic/stream.

type Producer

type Producer interface {
	Publish(ctx context.Context, data []byte) error
	Close() error
}

Producer publishes messages to a topic/stream.

Jump to

Keyboard shortcuts

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