libmq

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderSet = wire.NewSet(NewMQ)

Functions

This section is empty.

Types

type MQ

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

func NewMQ

func NewMQ(c *conf.MQ) (*MQ, func(), error)

func (*MQ) Publish

func (a *MQ) Publish(ctx context.Context, topic string, payload []byte) error

func (*MQ) RegisterTopic

func (a *MQ) RegisterTopic(topic Topic) error

func (*MQ) Start

func (a *MQ) Start(ctx context.Context) error

func (*MQ) Stop

func (a *MQ) Stop(ctx context.Context) error

type Topic

type Topic interface {
	Name() string
	Consume(context.Context, []byte) error
	SetMQ(*MQ)
}

type TopicImpl

type TopicImpl[T any] struct {
	// contains filtered or unexported fields
}

func NewTopic

func NewTopic[T any](topic string, consumerFunc func(context.Context, *T) error) *TopicImpl[T]

func (*TopicImpl[T]) Consume

func (t *TopicImpl[T]) Consume(ctx context.Context, i []byte) error

func (*TopicImpl[T]) Name

func (t *TopicImpl[T]) Name() string

func (*TopicImpl[T]) Publish

func (t *TopicImpl[T]) Publish(ctx context.Context, i T) error

func (*TopicImpl[T]) SetMQ

func (t *TopicImpl[T]) SetMQ(mq *MQ)

Jump to

Keyboard shortcuts

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