channel

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseChannel

type BaseChannel struct {
	Bus       *bus.MessageBus
	AllowList map[string]bool
}

BaseChannel provides common functionality

func (*BaseChannel) IsAllowed

func (b *BaseChannel) IsAllowed(senderID string) bool

IsAllowed checks if sender is permitted

func (*BaseChannel) PublishInbound

func (b *BaseChannel) PublishInbound(msg *bus.InboundMessage)

PublishInbound sends message to bus

type Channel

type Channel interface {
	Name() string
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	Send(ctx context.Context, msg *bus.OutboundMessage) error
	IsAllowed(senderID string) bool
}

Channel interface for chat platforms

type DeliveryPolicy added in v0.5.1

type DeliveryPolicy struct {
	MaxConcurrentSends int
	RetryMaxAttempts   int
	RetryBaseBackoff   time.Duration
	RetryMaxBackoff    time.Duration
	RateLimitPerSecond int
	DedupWindow        time.Duration
}

DeliveryPolicy defines outbound retry, backoff, rate limit and dedup behavior.

type Manager

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

Manager coordinates all channels

func NewManager

func NewManager(msgBus *bus.MessageBus) *Manager

NewManager creates a channel manager

func NewManagerWithLimit added in v0.1.4

func NewManagerWithLimit(msgBus *bus.MessageBus, maxConcurrentSends int) *Manager

NewManagerWithLimit creates a channel manager with bounded outbound send concurrency.

func NewManagerWithPolicy added in v0.5.1

func NewManagerWithPolicy(msgBus *bus.MessageBus, policy DeliveryPolicy) *Manager

NewManagerWithPolicy creates a manager with custom outbound delivery policy.

func (*Manager) Names

func (m *Manager) Names() []string

Names returns registered channel names

func (*Manager) Register

func (m *Manager) Register(ch Channel)

Register adds a channel

func (*Manager) RouteOutbound

func (m *Manager) RouteOutbound(ctx context.Context)

RouteOutbound sends outbound messages to appropriate channels

func (*Manager) SetRuntimeMetrics added in v0.4.2

func (m *Manager) SetRuntimeMetrics(recorder *metrics.RuntimeMetrics)

SetRuntimeMetrics attaches a recorder used for outbound send metrics.

func (*Manager) StartAll

func (m *Manager) StartAll(ctx context.Context)

StartAll starts all channels

func (*Manager) StopAll

func (m *Manager) StopAll(ctx context.Context)

StopAll stops all channels

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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