messenger

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Module exported to initialise a new Publisher, Subscriber and Router.

Functions

This section is empty.

Types

type Publisher

type Publisher struct {
	*amqp.Publisher
	*gochannel.GoChannel
	// contains filtered or unexported fields
}

Publisher is a wrapper for amqp.Publisher.

func NewPublisher

func NewPublisher(cfg *config.Config, logger *logger.Logger, health *health.Checks) (*Publisher, error)

NewPublisher returns a new publisher.

func NewTestPublisher

func NewTestPublisher(logger *logger.Logger) *Publisher

NewTestPublisher returns a new publisher for testing purposes.

func (*Publisher) Check

func (p *Publisher) Check() health.Check

Check is used to perform healthcheck.

func (*Publisher) MessagePublisher

func (p *Publisher) MessagePublisher() message.Publisher

MessagePublisher returns the message publisher.

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, topic string, messages ...*message.Message) error

Publish is a wrapper for the MessagePublishr.Publish.

type Router

type Router struct {
	*message.Router
	// contains filtered or unexported fields
}

Router is a wrapper for a message router.

func NewRouter

func NewRouter(
	cfg *config.Config,
	publisher *Publisher,
	subscriber *Subscriber,
	logger *logger.Logger,
	health *health.Checks,
) (*Router, error)

NewRouter returns a new router.

func (*Router) AddHandler

func (r *Router) AddHandler(
	handlerName,
	subscribeTopic,
	publishTopic string,
	handlerFunc message.HandlerFunc,
) *message.Handler

AddHandler is a wrapper around message.Router.AddHandler.

func (*Router) AddNoPublisherHandler

func (r *Router) AddNoPublisherHandler(
	handlerName,
	subscribeTopic string,
	handlerFunc message.NoPublishHandlerFunc,
) *message.Handler

AddNoPublisherHandler is a wrapper around message.Router.AddNoPublisherHandler.

func (*Router) Check

func (r *Router) Check() health.Check

Check is used to perform healthcheck.

func (*Router) Publisher

func (r *Router) Publisher() *Publisher

Publisher returns the publisher for the router.

func (*Router) Subscriber

func (r *Router) Subscriber() *Subscriber

Subscriber returns the subscriber for the router.

type Subscriber

type Subscriber struct {
	*amqp.Subscriber
	*gochannel.GoChannel
	// contains filtered or unexported fields
}

Subscriber is a wrapper for amqp.Subscriber.

func NewSubscriber

func NewSubscriber(cfg *config.Config, logger *logger.Logger, health *health.Checks) (*Subscriber, error)

NewSubscriber returns a new subscriber.

func NewTestSubscriber

func NewTestSubscriber(logger *logger.Logger) *Subscriber

NewTestSubscriber returns a new subscriber for testing purposes.

func (*Subscriber) Check

func (s *Subscriber) Check() health.Check

Check is used to perform healthcheck.

func (*Subscriber) MessageSubscriber

func (s *Subscriber) MessageSubscriber() message.Subscriber

MessageSubscriber returns the message subscriber.

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error)

Subscribe is a wrapper for the MessageSubscriber.Subscribe.

Jump to

Keyboard shortcuts

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