pubsub

package module
v0.0.0-...-49849e0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: MIT Imports: 9 Imported by: 0

README

leo-message

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(l log.Logger) *logger

Types

type Job

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

func NewPubSubJob

func NewPubSubJob(
	name string,
	subscribeTopic string,
	subscriber message.Subscriber,
	publishTopic string,
	publisher message.Publisher,
	handlerFunc func(msg *message.Message) ([]*message.Message, error),
	middlewares ...message.HandlerMiddleware,
) *Job

func NewSubJob

func NewSubJob(
	name string,
	subscribeTopic string,
	subscriber message.Subscriber,
	handlerFunc func(msg *message.Message) error,
	middlewares ...message.HandlerMiddleware,
) *Job

func (Job) Name

func (j Job) Name() string

func (Job) PublishTopic

func (j Job) PublishTopic() string

func (Job) Publisher

func (j Job) Publisher() message.Publisher

func (Job) SubscribeTopic

func (j Job) SubscribeTopic() string

func (Job) Subscriber

func (j Job) Subscriber() message.Subscriber

type Option

type Option func(o *options)

func CloseTimeout

func CloseTimeout(timeout time.Duration) Option

func Logger

func Logger(l log.Logger) Option

func Middleware

func Middleware(mdw ...message.HandlerMiddleware) Option

func Plugin

func Plugin(p ...message.RouterPlugin) Option

func PublisherDecorator

func PublisherDecorator(d ...message.PublisherDecorator) Option

func SubscriberDecorator

func SubscriberDecorator(d ...message.SubscriberDecorator) Option

type Task

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

func New

func New(jobs []*Job, opts ...Option) *Task

func (*Task) Jobs

func (task *Task) Jobs() []*Job

func (*Task) Start

func (task *Task) Start(ctx context.Context) error

func (*Task) Stop

func (task *Task) Stop(ctx context.Context) error

func (*Task) String

func (task *Task) String() string

Jump to

Keyboard shortcuts

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