Documentation
¶
Index ¶
- type Channel
- type Config
- type Connection
- type MQ
- func (mq *MQ) Check(_ context.Context) error
- func (mq *MQ) Dial() error
- func (mq *MQ) Init(ctx context.Context, log logger.Logger) error
- func (mq *MQ) Publish(ctx context.Context, target string, routingKey, payload []byte) error
- func (mq *MQ) Subscribe(ctx context.Context, target string, message query.Response) error
- func (mq *MQ) UnSubscribe(target string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
Channel amqp.Channel wapper
type Connection ¶
type Connection struct {
*amqp.Connection
// contains filtered or unexported fields
}
Connection amqp.Connection wrapper
func (*Connection) Channel ¶
func (c *Connection) Channel() (*Channel, error)
Channel wraps amqp.Connection.Channel to provide an auto-reconnecting channel.
type MQ ¶
type MQ struct {
// contains filtered or unexported fields
}
func (*MQ) Dial ¶
Dial wraps amqp.Dial to establish a connection and set up automatic reconnection in case the connection is lost.
func (*MQ) Init ¶
Init initializes the RabbitMQ connection and sets up the channel. It also sets up a graceful shutdown mechanism to close the connection and channel when the context is done.
func (*MQ) Subscribe ¶
Subscribe binds a durable queue to a fanout exchange named target, then delivers messages to message.Chan. The exchange is created if missing (durable fanout). Publish must use the same exchange name as target with any routing key. Returns immediately; a background goroutine reads deliveries until ctx is done or the subscription channel is closed.