events

package
v1.15.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Service string         `json:"service"`
	Type    string         `json:"type"`
	Payload map[string]any `json:"payload"`
}

Event represents a generic event structure for the event queue

type Producer

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

Producer wraps the base queue producer for publishing events

func NewProducer

func NewProducer(connConfig queue.ConnectionConfig, config ProducerConfig) (*Producer, error)

NewProducer creates a new event producer

func (*Producer) Close

func (p *Producer) Close() error

Close closes the producer connection

func (*Producer) IsConnected

func (p *Producer) IsConnected() bool

IsConnected returns true if the producer has a valid connection

func (*Producer) Publish

func (p *Producer) Publish(ctx context.Context, eventType string, payload map[string]any) error

Publish publishes an event to the queue

func (*Producer) PublishAsync

func (p *Producer) PublishAsync(eventType string, payload map[string]any)

PublishAsync publishes an event asynchronously (fire and forget)

func (*Producer) ServiceName

func (p *Producer) ServiceName() string

ServiceName returns the service name configured for this producer

type ProducerConfig

type ProducerConfig struct {
	// ServiceName is the name of the service publishing events
	ServiceName string

	// QueueConfig allows overriding the default queue configuration (optional)
	QueueConfig *queue.Config
}

ProducerConfig holds configuration for the event producer

Jump to

Keyboard shortcuts

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