Documentation
¶
Index ¶
- func Close() error
- func Consume() (<-chan amqp.Delivery, error)
- func Push(ctx context.Context, data []byte) error
- func ReadMsgs(ctx context.Context, maxAmount int, wait time.Duration, ...)
- func UnsafePush(ctx context.Context, data []byte) error
- type Client
- func (c *Client) Check(ctx context.Context) error
- func (client *Client) Close() error
- func (client *Client) Consume() (<-chan amqp.Delivery, error)
- func (client *Client) Push(ctx context.Context, data []byte) error
- func (client *Client) ReadMsgs(ctx context.Context, maxAmount int, wait time.Duration, ...)
- func (client *Client) UnsafePush(ctx context.Context, data []byte) error
- type Credentials
- type RabbitDelivery
- type RabbitMQClient
- type ReadMsgCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
type Credentials ¶
type Credentials struct {
Host string `mapstructure:"host"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
}
func (*Credentials) SourceString ¶
func (r *Credentials) SourceString() string
type RabbitDelivery ¶
type RabbitDelivery interface {
// Ack acknowledges processing of a Delivery.
Ack(multiple bool) error
// Nack negatively acknowledges a Delivery.
Nack(multiple bool, requeue bool) error
// Reject rejects a delivery.
Reject(requeue bool) error
// Body returns the message body.
Body() []byte
// Acknowledger provides acknowledgement information.
Acknowledger() amqp.Acknowledger
// Header returns the message header.
Header() amqp.Table
// ContentType returns the message content type.
ContentType() string
// ContentEncoding returns the message content encoding.
ContentEncoding() string
// DeliveryMode returns the delivery mode.
DeliveryMode() uint8
// Priority returns the message priority.
Priority() uint8
// CorelationId returns the correlation id.
CorelationId() string
// ReplyTo returns the reply to value.
ReplyTo() string
// Expiration returns the message expiration.
Expiration() string
// MessageId returns the message id.
MessageId() string
// Timestamp returns the message timestamp.
Timestamp() time.Time
// Type returns the message type.
Type() string
// UserId returns the creating user id.
UserId() string
// AppId returns the creating application id.
AppId() string
// ConsumerTag returns the consumer tag.
ConsumerTag() string
// MessageCount returns the number of messages pending acknowledgement.
MessageCount() uint32
// DeliveryTag returns the delivery tag.
DeliveryTag() uint64
// Redelivered returns true if this message is being redelivered.
Redelivered() bool
// Exchange returns the exchange this message was published to.
Exchange() string
// RoutingKey returns the routing key used when publishing this message.
RoutingKey() string
}
func NewDelivery ¶
func NewDelivery(d amqp.Delivery) RabbitDelivery
type RabbitMQClient ¶
type RabbitMQClient interface {
Check(ctx context.Context) error
ReadMsgs(ctx context.Context, maxAmount int, wait time.Duration, callback ReadMsgCallback)
Push(ctx context.Context, data []byte) error
UnsafePush(ctx context.Context, data []byte) error
Consume() (<-chan amqp.Delivery, error)
Close() error
}
func Init ¶
func Init(ctx context.Context, queueName string, log logger.Logger, creds *Credentials) RabbitMQClient
type ReadMsgCallback ¶
type ReadMsgCallback func(ctx context.Context, d RabbitDelivery) error
Click to show internal directories.
Click to hide internal directories.