Documentation
¶
Index ¶
- type AMQPChannel
- type AMQPConnection
- type Connection
- type Consumer
- type DefaultWorker
- type Handler
- type HandlerFunc
- type Middleware
- type Option
- func WithConsumeArgs(consumer string, autoAck, exclusive, noLocal, noWait bool, args amqp.Table) Option
- func WithContext(ctx context.Context) Option
- func WithInitFunc(f func(conn AMQPConnection) (AMQPChannel, error)) Option
- func WithLogger(l logger.Logger) Option
- func WithRetryPeriod(dur time.Duration) Option
- func WithWorker(w Worker) Option
- type ParallelWorker
- type Worker
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AMQPChannel ¶
type AMQPConnection ¶
type AMQPConnection interface { }
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func NewConnection ¶
func NewConnection(amqpConn AMQPConnection, closeCh chan struct{}) *Connection
func (*Connection) AMQPConnection ¶
func (c *Connection) AMQPConnection() AMQPConnection
func (*Connection) NotifyClose ¶
func (c *Connection) NotifyClose() chan struct{}
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func (*Consumer) NotifyClosed ¶
func (c *Consumer) NotifyClosed() <-chan struct{}
func (*Consumer) NotifyReady ¶
func (c *Consumer) NotifyReady() <-chan struct{}
func (*Consumer) NotifyUnready ¶
type DefaultWorker ¶
type Handler ¶
func Wrap ¶
func Wrap(handler Handler, middlewares ...Middleware) Handler
Example ¶
package main import ( "context" "github.com/makasim/amqpextra/consumer" "github.com/makasim/amqpextra/consumer/middleware" "github.com/streadway/amqp" ) func main() { // wrap a handler by some middlewares consumer.Wrap( consumer.HandlerFunc(func(ctx context.Context, msg amqp.Delivery) interface{} { // process message msg.Ack(false) return nil }), middleware.HasCorrelationID(), middleware.HasReplyTo(), ) }
Output:
type HandlerFunc ¶
type Middleware ¶
type Option ¶
type Option func(c *Consumer)
func WithConsumeArgs ¶
func WithContext ¶
func WithInitFunc ¶
func WithInitFunc(f func(conn AMQPConnection) (AMQPChannel, error)) Option
func WithLogger ¶
func WithRetryPeriod ¶
func WithWorker ¶
type ParallelWorker ¶
func NewParallelWorker ¶
func NewParallelWorker(num int) *ParallelWorker
Directories
¶
Path | Synopsis |
---|---|
Package mock_consumer is a generated GoMock package.
|
Package mock_consumer is a generated GoMock package. |
Click to show internal directories.
Click to hide internal directories.