Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTaskConsumer ¶
func NewTaskConsumer(ctx context.Context, opts ...func(*ConsumerOption)) *taskConsumer
Types ¶
type Channel ¶
type Channel interface { Publish(exchange, key string, mandatory, immediate bool, msg amqp.Publishing) error Consume(queue, consumer string, autoAck, exclusive, noLocal, noWail bool, args amqp.Table) (<-chan amqp.Delivery, error) Close() error }
Channel is a channel interface to make testing possible. It is highly recommended to use *amqp.Channel as the interface implementation.
type ConsumerOption ¶
type ConsumerOption struct { Pool *routine.Pool // goroutine safe run pool Manager ManagerExecutor // manager executor how to run Marshal mq.MarshalAPI // mq assemble request or response JSONHandler jsoniter.API ParamPool ParamPool // get Param Validator validator.Validator }
type Executor ¶
type Executor interface { SafeCopy() Executor ID() string Run(ctx context.Context, data []byte) error }
Executor your business should implement it
type ManagerExecutor ¶
type ManagerExecutor interface { Register(executors ...Executor) error Run(ctx context.Context, param *Param) error }
func NewManager ¶
func NewManager() ManagerExecutor
type ParamPool ¶
func NewParamPool ¶
func NewParamPool() ParamPool
type ProducerOption ¶
type TaskProducer ¶
type TaskProducer struct { ProducerOption // contains filtered or unexported fields }
func NewTaskProducer ¶
func NewTaskProducer(opts ...func(*ProducerOption)) *TaskProducer
NewProducer return message.Publisher
func (*TaskProducer) Close ¶
func (t *TaskProducer) Close() error
func (*TaskProducer) GetParam ¶
func (t *TaskProducer) GetParam() *Param
Click to show internal directories.
Click to hide internal directories.