types

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Kafka worker
	Kafka Worker = "kafka"
	// RedisSubscriber worker
	RedisSubscriber = "redis_subscriber"
	// RabbitMQ worker
	RabbitMQ = "rabbit_mq"
	// Scheduler worker
	Scheduler = "scheduler"
	// TaskQueue worker
	TaskQueue = "task_queue"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database int

Database enum

const (
	// SQL database type
	SQL Database = iota

	// Mongo database type
	Mongo

	// Redis database type
	Redis

	// ElasticSearch database type
	ElasticSearch
)

type MiddlewareFunc

type MiddlewareFunc func(context.Context) context.Context

MiddlewareFunc type

type MiddlewareGroup

type MiddlewareGroup map[string]MiddlewareFunc

MiddlewareGroup type

func (MiddlewareGroup) Add

func (mw MiddlewareGroup) Add(fullMethod string, middlewareFunc MiddlewareFunc)

Add register full method to middleware

func (MiddlewareGroup) AddProto

func (mw MiddlewareGroup) AddProto(protoDesc protoreflect.FileDescriptor, method string, middlewareFunc MiddlewareFunc)

AddProto register proto for grpc middleware

type Module

type Module string

Module is the type returned by a Classifier module

type Service

type Service string

Service is the type returned by a classifier service name

type Worker

type Worker string

Worker is the type returned by a classifier worker (kafka, redis subscriber, rabbitmq, scheduler, task queue)

type WorkerErrorHandler

type WorkerErrorHandler func(ctx context.Context, workerType Worker, workerName string, message []byte, err error)

WorkerErrorHandler types

type WorkerHandlerFunc

type WorkerHandlerFunc func(ctx context.Context, message []byte) error

WorkerHandlerFunc types

type WorkerHandlerGroup

type WorkerHandlerGroup struct {
	Handlers []struct {
		Pattern      string
		HandlerFunc  WorkerHandlerFunc
		ErrorHandler []WorkerErrorHandler
	}
}

WorkerHandlerGroup group of worker handlers by pattern string

func (*WorkerHandlerGroup) Add

func (m *WorkerHandlerGroup) Add(pattern string, handlerFunc WorkerHandlerFunc, errHandlers ...WorkerErrorHandler)

Add method from WorkerHandlerGroup, pattern can contains unique topic name, key, and task name

Jump to

Keyboard shortcuts

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