Documentation
¶
Index ¶
- func EventPayloadToMessage(payload any) (*message.Message, error)
- func InitTracedRouter() (*message.Router, error)
- func NewNamedPublisherDecorator(name string, pub message.Publisher, options ...Option) message.Publisher
- func NewPublisherDecorator(pub message.Publisher, options ...Option) message.Publisher
- func Trace(options ...Option) message.HandlerMiddleware
- func TraceConsumerHandler(h message.NoPublishHandlerFunc, options ...Option) message.NoPublishHandlerFunc
- func TraceHandler(h message.HandlerFunc, options ...Option) message.HandlerFunc
- type BasePgsqlPubSubProcessor
- func (bps *BasePgsqlPubSubProcessor) EmitEvent(topic string, payload any) error
- func (bps *BasePgsqlPubSubProcessor) EmitEventMessage(topic string, payload *message.Message) error
- func (bps BasePgsqlPubSubProcessor) GetDB() deebee.IDatabase
- func (bps BasePgsqlPubSubProcessor) GetPublisher() message.Publisher
- func (bps BasePgsqlPubSubProcessor) GetRouter() *message.Router
- func (bps BasePgsqlPubSubProcessor) GetSubscriber() *sql.Subscriber
- func (bps *BasePgsqlPubSubProcessor) RegisterSubscriberHandlers() error
- func (bps *BasePgsqlPubSubProcessor) Run() error
- type ErrPubSubHandlersNotImplemented
- type IPubSubEventProcessor
- type NoOpEvent
- type NoOpEventHandler
- type Option
- type PublisherDecorator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EventPayloadToMessage ¶ added in v0.1.21
func InitTracedRouter ¶
func NewNamedPublisherDecorator ¶
func NewNamedPublisherDecorator(name string, pub message.Publisher, options ...Option) message.Publisher
NewNamedPublisherDecorator instantiates a PublisherDecorator with a provided name.
func NewPublisherDecorator ¶
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 ¶
func NewPubSub(db deebee.IDatabase) (*BasePgsqlPubSubProcessor, error)
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 ¶
func (bps BasePgsqlPubSubProcessor) GetDB() deebee.IDatabase
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 ¶
func (e ErrPubSubHandlersNotImplemented) Error() string
Error returns the error message.
type IPubSubEventProcessor ¶
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
func (h NoOpEventHandler) Handle() message.NoPublishHandlerFunc
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 ¶
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.