queue

package
v1.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// PanicLevel level, highest level of severity. Logs and then calls panic with the
	// message passed to Debug, Info, ...
	PanicLevel = iota
	// FatalLevel level. Logs and then calls `logger.Exit(1)`. It will exit even if the
	// logging level is set to Panic.
	FatalLevel
	// ErrorLevel level. Logs. Used for errors that should definitely be noted.
	// Commonly used for hooks to send errors to an error tracking service.
	ErrorLevel
	// WarnLevel level. Non-critical entries that deserve eyes.
	WarnLevel
	// InfoLevel level. General operational entries about what's going on inside the
	// application.
	InfoLevel
	// DebugLevel level. Usually only enabled when debugging. Very verbose logging.
	DebugLevel
	// TraceLevel level. Designates finer-grained informational events than the Debug.
	TraceLevel
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	PoolNum uint
	// contains filtered or unexported fields
}

func NewMemory

func NewMemory(poolNum uint) *Memory

NewMemory 内存模式

func (*Memory) Consumer

func (m *Memory) Consumer(ctx context.Context, name string, f storage.ConsumerFunc, optionFuncs ...func(*storage.ConsumeOptions))

Consumer 监听消费者

func (*Memory) Publish

func (m *Memory) Publish(ctx context.Context, message storage.Messager, optionFuncs ...func(*storage.PublishOptions)) error

Publish 消息入生产者

func (*Memory) Run

func (m *Memory) Run(ctx context.Context)

func (*Memory) Shutdown

func (m *Memory) Shutdown(ctx context.Context)

func (*Memory) String

func (*Memory) String() string

type Message

type Message struct {
	Id         string
	RoutingKey string
	Values     map[string]interface{}
	GroupId    string
	ErrorCount uint64
}

func (*Message) GetErrorCount

func (m *Message) GetErrorCount() uint64

func (*Message) GetId

func (m *Message) GetId() string

func (*Message) GetPrefix

func (m *Message) GetPrefix() (prefix string)

func (*Message) GetRoutingKey

func (m *Message) GetRoutingKey() string

func (*Message) GetValues

func (m *Message) GetValues() map[string]interface{}

func (*Message) SetErrorCount

func (m *Message) SetErrorCount(count uint64)

func (*Message) SetErrorIncr

func (m *Message) SetErrorIncr()

func (*Message) SetId

func (m *Message) SetId(id string)

func (*Message) SetPrefix

func (m *Message) SetPrefix(prefix string)

func (*Message) SetRoutingKey

func (m *Message) SetRoutingKey(routingKey string)

func (*Message) SetValues

func (m *Message) SetValues(values map[string]interface{})

type NSQ

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

func NewNSQ

func NewNSQ(addresses []string, cfg *nsq.Config, channelPrefix string) (*NSQ, error)

NewNSQ nsq模式 只能监听一个channel

func (*NSQ) Consumer

func (e *NSQ) Consumer(ctx context.Context, name string, f storage.ConsumerFunc, optionFuncs ...func(*storage.ConsumeOptions))

Consumer 监听消费者

func (*NSQ) Publish

func (e *NSQ) Publish(ctx context.Context, message storage.Messager, optionFuncs ...func(*storage.PublishOptions)) error

Publish 消息入生产者

func (*NSQ) Run

func (e *NSQ) Run(ctx context.Context)

func (*NSQ) Shutdown

func (e *NSQ) Shutdown(ctx context.Context)

func (NSQ) String

func (NSQ) String() string

String 字符串类型

type QLoger added in v0.3.7

type QLoger struct {
	Ctx    context.Context
	Logger *glog.Logger
}

func (*QLoger) Debug added in v0.3.7

func (q *QLoger) Debug(msg string, fields map[string]interface{})

func (*QLoger) Error added in v0.3.7

func (q *QLoger) Error(msg string, fields map[string]interface{})

func (*QLoger) Fatal added in v0.3.7

func (q *QLoger) Fatal(msg string, fields map[string]interface{})

func (*QLoger) Info added in v0.3.7

func (q *QLoger) Info(msg string, fields map[string]interface{})

func (*QLoger) Level added in v0.3.7

func (q *QLoger) Level(level string)

func (*QLoger) OutputPath added in v0.3.7

func (q *QLoger) OutputPath(path string) (err error)

func (*QLoger) Warning added in v0.3.7

func (q *QLoger) Warning(msg string, fields map[string]interface{})

type RabbitMQ

type RabbitMQ struct {
	Url               string
	ReconnectInterval int
	Handler           []rabbitmq.Handler
	Config            rabbitmq.Config

	ConsumerOptions *rabbitmq.ConsumerOptions

	PublisherOptions *rabbitmq.PublisherOptions
	Logger           rabbitmq.Logger
	// contains filtered or unexported fields
}

RabbitMQ cache implement

func NewRabbitMQ

func NewRabbitMQ(
	ctx context.Context,
	dsn string,
	reconnectInterval int,
	cfg *rabbitmq.Config,
	logger rabbitmq.Logger,
) (*RabbitMQ, error)

func (*RabbitMQ) Consumer

func (r *RabbitMQ) Consumer(ctx context.Context, queueName string, f storage.ConsumerFunc, optionFuncs ...func(*storage.ConsumeOptions))

Consumer 监听消费者

func (*RabbitMQ) Publish

func (r *RabbitMQ) Publish(ctx context.Context, message storage.Messager, optionFuncs ...func(*storage.PublishOptions)) error

Publish 消息入生产者

func (*RabbitMQ) Run

func (r *RabbitMQ) Run(ctx context.Context)

func (*RabbitMQ) Shutdown

func (r *RabbitMQ) Shutdown(ctx context.Context)

func (*RabbitMQ) String

func (r *RabbitMQ) String() string

type Redis

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

Redis cache implement

func NewRedis

func NewRedis(producerOptions *redisqueue.ProducerOptions,
	consumerOptions *redisqueue.ConsumerOptions) (*Redis, error)

NewRedis redis模式

func (*Redis) Consumer

func (r *Redis) Consumer(ctx context.Context, name string, f storage.ConsumerFunc, optionFuncs ...func(*storage.ConsumeOptions))

Consumer 监听消费者

func (*Redis) Publish

func (r *Redis) Publish(ctx context.Context, message storage.Messager, optionFuncs ...func(*storage.PublishOptions)) error

Publish 消息入生产者

func (*Redis) Run

func (r *Redis) Run(ctx context.Context)

func (*Redis) Shutdown

func (r *Redis) Shutdown(ctx context.Context)

func (Redis) String

func (Redis) String() string

type RocketConsumerOptions

type RocketConsumerOptions struct {
	GroupName         string
	MaxReconsumeTimes int32
}

type RocketMQ

type RocketMQ struct {
	Urls []string

	Credentials *primitive.Credentials
	// contains filtered or unexported fields
}

RocketMQ cache implement

func NewRocketMQ

func NewRocketMQ(
	ctx context.Context,
	urls []string,
	credentials *primitive.Credentials,
	logger *glog.Logger,
) (*RocketMQ, error)

func (*RocketMQ) Consumer

func (r *RocketMQ) Consumer(ctx context.Context, topicName string, f storage.ConsumerFunc, optionFuncs ...func(*storage.ConsumeOptions))

Consumer 监听消费者

func (*RocketMQ) Publish

func (r *RocketMQ) Publish(ctx context.Context, message storage.Messager, optionFuncs ...func(*storage.PublishOptions)) error

Publish 消息入生产者

func (*RocketMQ) Run

func (r *RocketMQ) Run(ctx context.Context)

func (*RocketMQ) Shutdown

func (r *RocketMQ) Shutdown(ctx context.Context)

func (*RocketMQ) String

func (r *RocketMQ) String() string

type RocketProducerOptions

type RocketProducerOptions struct {
	GroupName  string
	RetryTimes int
}

Jump to

Keyboard shortcuts

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