eeventdriven

package
v0.1.65 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventPayloadToMessage added in v0.1.21

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

func InitTracedRouter

func InitTracedRouter() (*message.Router, error)

func NewNamedPublisherDecorator

func NewNamedPublisherDecorator(name string, pub message.Publisher, options ...Option) message.Publisher

NewNamedPublisherDecorator instantiates a PublisherDecorator with a provided name.

func NewPublisherDecorator

func NewPublisherDecorator(pub message.Publisher, options ...Option) message.Publisher

NewPublisherDecorator instantiates a PublisherDecorator with a default name.

func Trace

func Trace(options ...Option) message.HandlerMiddleware

Trace defines a middleware that will add tracing.

func TraceConsumerHandler

func TraceConsumerHandler(h message.NoPublishHandlerFunc, options ...Option) message.NoPublishHandlerFunc

TraceConsumerHandler decorates a watermill NoPublishHandlerFunc to add tracing when a message is received.

func TraceHandler

func TraceHandler(h message.HandlerFunc, options ...Option) message.HandlerFunc

TraceHandler decorates a watermill HandlerFunc to add tracing when a message is received.

Types

type BasePgsqlPubSubProcessor

type BasePgsqlPubSubProcessor struct {
	Config config.Config
	// contains filtered or unexported fields
}

BasePgsqlPubSubProcessor provides foundational Pub/Sub capabilities using Watermill and PostgreSQL.

func NewPubSub

New initializes a new BasePgsqlPubSubProcessor with the given PostgreSQL connection pool.

func (*BasePgsqlPubSubProcessor) EmitEvent

func (bps *BasePgsqlPubSubProcessor) EmitEvent(topic string, payload any) error

EmitEvent publishes an event with the given topic and payload.

func (*BasePgsqlPubSubProcessor) EmitEventMessage added in v0.1.48

func (bps *BasePgsqlPubSubProcessor) EmitEventMessage(topic string, payload *message.Message) error

EmitEvent publishes an event with the given topic and payload.

func (BasePgsqlPubSubProcessor) GetDB

GetDB returns the PostgreSQL connection pool.

func (BasePgsqlPubSubProcessor) GetPublisher

func (bps BasePgsqlPubSubProcessor) GetPublisher() message.Publisher

GetPublisher returns the SQL publisher for the Pub/Sub processor.

func (BasePgsqlPubSubProcessor) GetRouter

func (bps BasePgsqlPubSubProcessor) GetRouter() *message.Router

GetRouter returns the message router.

func (BasePgsqlPubSubProcessor) GetSubscriber

func (bps BasePgsqlPubSubProcessor) GetSubscriber() *sql.Subscriber

GetSubscriber returns the SQL subscriber for the Pub/Sub processor.

func (*BasePgsqlPubSubProcessor) RegisterSubscriberHandlers

func (bps *BasePgsqlPubSubProcessor) RegisterSubscriberHandlers() error

RegisterSubscriberHandlers registers the event handlers. By default, it returns an error indicating that handlers are not implemented.

func (*BasePgsqlPubSubProcessor) Run

func (bps *BasePgsqlPubSubProcessor) Run() error

Run starts the Pub/Sub processor's router.

type ErrPubSubHandlersNotImplemented

type ErrPubSubHandlersNotImplemented struct{}

ErrPubSubHandlersNotImplemented is returned when Pub/Sub handlers are not implemented.

func (ErrPubSubHandlersNotImplemented) Error

Error returns the error message.

type IPubSubEventProcessor

type IPubSubEventProcessor interface {
	EmitEvent(topic string, payload any) error
	EmitEventMessage(topic string, payload *message.Message) error
	Run() error
	RegisterSubscriberHandlers() error
}

type NoOpEvent added in v0.1.50

type NoOpEvent struct{}

temporary no-op event and handler for testing purposes.

type NoOpEventHandler added in v0.1.50

type NoOpEventHandler struct{}

NoOpEventHandler is a handler that does nothing and acknowledges the message.

func NewNoOpEventHandler added in v0.1.50

func NewNoOpEventHandler() NoOpEventHandler

NewNoOpEventHandler creates a new NoOpEventHandler instance.

func (NoOpEventHandler) Handle added in v0.1.50

Handle returns a message handler function that acknowledges the message without processing.

type Option

type Option func(*conf)

Option provides a convenience wrapper for simple options that can be represented as functions.

func WithSpanAttributes

func WithSpanAttributes(attributes ...attribute.KeyValue) Option

WithSpanAttributes includes the given attributes to the generated Spans.

type PublisherDecorator

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

PublisherDecorator decorates a standard watermill publisher to add tracing capabilities.

func (*PublisherDecorator) Close

func (p *PublisherDecorator) Close() error

Close implements the watermill Publisher interface.

func (*PublisherDecorator) Publish

func (p *PublisherDecorator) Publish(topic string, messages ...*message.Message) error

Publish implements the watermill Publisher interface and creates traces. Publishing of messages are delegated to the decorated Publisher.

Jump to

Keyboard shortcuts

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