event

package
v0.92.0 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2026 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Overview

Package event provides event system definition and data event types.

Package event provides Watermill-based publish/subscribe infrastructure backed by Redis Streams.

Index

Constants

This section is empty.

Variables

View Source
var Publisher message.Publisher

Publisher is the global Watermill publisher, provided by NewPublisher via fx.

Functions

func BotEventFire added in v0.23.1

func BotEventFire(ctx types.Context, eventName string, param types.KV) error

func NewMessage

func NewMessage(payload any) (*message.Message, error)

NewMessage creates a Watermill message from the given payload, marshaled as JSON.

func NewPublisher

func NewPublisher(lc fx.Lifecycle, client *redis.Client) (message.Publisher, error)

NewPublisher creates a Watermill Redis Stream publisher using the shared Redis client.

func NewRouter

func NewRouter(_ *sdktrace.TracerProvider) (*message.Router, error)

NewRouter creates a Watermill message router with standard middleware.

func NewSubscriber

func NewSubscriber(lc fx.Lifecycle, client *redis.Client) (message.Subscriber, error)

NewSubscriber creates a Watermill Redis Stream subscriber using the shared Redis client.

func PublishMessage

func PublishMessage(ctx context.Context, topic string, payload any) error

PublishMessage publishes a message to the given topic with OpenTelemetry tracing.

func SendMessage

func SendMessage(ctx types.Context, msg types.MsgPayload) error

func TraceConsumerMiddleware added in v0.92.0

func TraceConsumerMiddleware() message.HandlerMiddleware

TraceConsumerMiddleware returns a Watermill middleware that extracts OTel trace context from message metadata and creates a consumer span for each incoming message.

Types

This section is empty.

Jump to

Keyboard shortcuts

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