events

package module
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2025 License: MIT Imports: 16 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeEvent added in v0.1.1

func DecodeEvent[T any](v *validation.Validator, ctx context.Context, eventJson string) (*T, error)

func Validations added in v0.1.2

func Validations() map[string]validation.ValidationFunc

Types

type BasicHandler

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

func (*BasicHandler) MsgReceived

func (b *BasicHandler) MsgReceived(ctx context.Context, event contract.Message, ack func())

func (*BasicHandler) Register added in v0.1.7

func (b *BasicHandler) Register(event string, handler domain.EventHandlerFunc)

type MessagePublishedMetric

type MessagePublishedMetric struct {
	Channel string `metric:"channel"`
	Event   string `metric:"event"`
	Payload string `metric:"payload"`
}

type Publisher

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

func NewPublisher

func NewPublisher(client *redis.Client) *Publisher

func (Publisher) Publish

func (p Publisher) Publish(ctx context.Context, message domain.PublishableMessage) error

type Subscriber

type Subscriber struct {
	Validator *validation.Validator
	// contains filtered or unexported fields
}

func NewSubscriber

func NewSubscriber(validator *validation.Validator, serviceName, hostName string, rdb *redis.Client) *Subscriber

func (*Subscriber) Ack added in v0.1.7

func (s *Subscriber) Ack(msgCtx context.Context, stream string, msg redis.XMessage)

func (*Subscriber) DecodeHeader added in v0.1.6

func (s *Subscriber) DecodeHeader(msg redis.XMessage) (*contract.Header, error)

func (*Subscriber) Listen

func (s *Subscriber) Listen(ctx context.Context) error

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(stream string) *BasicHandler

Subscribe registers a handler for a given stream (channel).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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