bus

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

internal/evolution/bus/bus.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EvolutionBus

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

EvolutionBus manages the flow of information using a Pub/Sub model for the OODA loop.

func NewEvolutionBus

func NewEvolutionBus(logger *zap.Logger, bufferSize int) *EvolutionBus

NewEvolutionBus initializes the EvolutionBus.

func (*EvolutionBus) Acknowledge

func (eb *EvolutionBus) Acknowledge(msg Message)

Acknowledge signals that a message has been processed by a consumer.

func (*EvolutionBus) Post

func (eb *EvolutionBus) Post(ctx context.Context, msgType models.MessageType, payload interface{}) error

Post sends a message onto the bus. Blocks if subscriber buffers are full.

func (*EvolutionBus) Shutdown

func (eb *EvolutionBus) Shutdown()

Shutdown gracefully closes the bus.

func (*EvolutionBus) Subscribe

func (eb *EvolutionBus) Subscribe(msgTypes ...models.MessageType) (<-chan Message, func())

Subscribe returns a channel to listen for specific message types.

type Message

type Message struct {
	ID        string
	Timestamp time.Time
	Type      models.MessageType
	Payload   interface{}
}

Message is the envelope for data transmitted over the EvolutionBus.

Jump to

Keyboard shortcuts

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