task

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SrvName = "TaskService"
)

Variables

This section is empty.

Functions

func CallbackWrapHandler

func CallbackWrapHandler(handler SubHandler, callback CallbackFunc) storage.ConsumerFunc

func Services added in v0.1.6

func Services() *tService

func WrapHandler

func WrapHandler(handler SubHandler) storage.ConsumerFunc

Types

type CallbackFunc

type CallbackFunc func(context.Context, interface{}) error

CallbackFunc 消费结果统一回调

type Handler

type Handler interface {
	Handle(ctx context.Context, msg storage.Messager) error
}

Handler 任务MQ路由的回调接口/**/

type MemoryService added in v0.1.5

type MemoryService interface {
	Service
	AddTasks(task ...MemoryTask) MemoryService
}

type MemorySpec

type MemorySpec struct {
	TaskName   string
	RoutingKey string
}

type MemoryTask

type MemoryTask interface {
	GetSpec() *MemorySpec
	Handler
}

type NsqService added in v0.1.5

type NsqService interface {
	Service
	AddTasks(task ...NsqTask) NsqService
}

type NsqSpec

type NsqSpec struct {
	TaskName     string
	RoutingKey   string
	Exchange     string
	ExchangeType string
	QueueName    string
	RoutingMap   map[string]SubHandler
	ConsumerNum  int
	CTag         string
}

type NsqTask

type NsqTask interface {
	GetSpec(ctx context.Context) *NsqSpec
	Handler
}

type RabbitMqService added in v0.1.4

type RabbitMqService interface {
	Service
	AddTasks(task ...RabbitMqTask) RabbitMqService
}

type RabbitMqSpec

type RabbitMqSpec struct {
	TaskName     string
	RoutingKeys  []string
	RoutingKey   string
	Exchange     string
	ExchangeType string
	QueueName    string
	RoutingMap   map[string]SubHandler
	ConsumerNum  int
	AutoAck      bool
}

func (*RabbitMqSpec) GetRoutingKeys

func (r *RabbitMqSpec) GetRoutingKeys() []string

func (*RabbitMqSpec) Route

func (r *RabbitMqSpec) Route(routingKey string) (handler SubHandler, ifExist bool)

type RabbitMqTask

type RabbitMqTask interface {
	GetSpec(ctx context.Context) *RabbitMqSpec
	Handler
}

type RocketMqService added in v0.1.5

type RocketMqService interface {
	Service
	AddTasks(task ...RocketMqTask) RocketMqService
}

type RocketMqSpec

type RocketMqSpec struct {
	TaskName     string
	RoutingKey   string
	Exchange     string
	ExchangeType string
	QueueName    string
	RoutingMap   map[string]SubHandler
	ConsumerNum  int
	AutoAck      bool
}

type RocketMqTask

type RocketMqTask interface {
	GetSpec(ctx context.Context) *RocketMqSpec
	Handler
}

type Service

type Service interface {
	String() string
	Start(ctx context.Context)
}

type SubHandler

type SubHandler interface {
	Handle(ctx context.Context, msg storage.Messager) (interface{}, error)
}

Jump to

Keyboard shortcuts

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