Documentation
¶
Index ¶
- Constants
- type Bind
- type ConsumerConfig
- type ControlQosConfig
- type Exchange
- type Message
- type ProducerConfig
- type Queue
- type RabbitInterface
- type Rbm_pool
- func (rbm *Rbm_pool) CloseConnection() error
- func (rbm *Rbm_pool) CompleteDeclare(cq []Queue, ce []Exchange) []error
- func (rbm *Rbm_pool) CompleteExchangeDeclare(ce []Exchange) []error
- func (rbm *Rbm_pool) CompleteQueueDeclare(cq []Queue) []error
- func (rbm *Rbm_pool) Connect() (RabbitInterface, error)
- func (rbm *Rbm_pool) Consumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery))
- func (rbm *Rbm_pool) GetAmqpChannel() *amqp.Channel
- func (rbm *Rbm_pool) GetAmqpConnection() *amqp.Connection
- func (rbm *Rbm_pool) GetConnect() *Rbm_pool
- func (rbm *Rbm_pool) GetConnectStatus() bool
- func (rbm *Rbm_pool) Producer(ctx context.Context, pc *ProducerConfig, msg *Message) error
- func (rbm *Rbm_pool) SimpleExchangeDeclare(se Exchange) error
- func (rbm *Rbm_pool) SimpleQueueDeclare(sq Queue) (queue amqp.Queue, err error)
- func (rbm *Rbm_pool) StartConsumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery))
Constants ¶
View Source
const DEFAULT_MAX_RECONNECT_TIMES = 3 // 3 attempts
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumerConfig ¶
type ControlQosConfig ¶
type ProducerConfig ¶
type RabbitInterface ¶
type RabbitInterface interface { // Connect creates a new connection and returns RabbitInterface to access functions and error Connect() (RabbitInterface, error) // GetConnect gets the active connection GetConnect() *Rbm_pool // GetConnectStatus get the status of connection GetConnectStatus() bool // CloseConnection closes the active connection CloseConnection() error // SimpleQueueDeclare used to declare a single Queue into RabbitMQ and returns it or an error SimpleQueueDeclare(sq Queue) (queue amqp.Queue, err error) // CompleteQueueDeclare used to declare a multiple Queue into RabbitMQ and returns a list of errors if happens. // // NOTE: If you run this function defining the Bind field contained in Queue, you must have to had defined // an Exchange first and then passing it to the field. CompleteQueueDeclare(sq []Queue) []error // SimpleExchangeDeclare used to declare a single Exchange into RabbitMQ and returns an error if happens SimpleExchangeDeclare(se Exchange) error // CompleteExchangeDeclare used to declare a multiple Exchange into RabbitMQ and returns a list of errors if happens CompleteExchangeDeclare(ce []Exchange) []error // CompleteDeclare used to fully declare multiple Queue and Exchange into // RabbitMQ and returns a list of errors if happens. // // NOTE: You can pass empty arrays to this function if not present in your project. If your project // doesn't contain binds, just don't set the Bind field contained in Queue struct. CompleteDeclare(cq []Queue, ce []Exchange) []error // Producer publishes a Message to RabbitMQ following the configuration passed on ProducerConfig Producer(ctx context.Context, pc *ProducerConfig, msg *Message) error // Consumer consumes a Queue on RabbitMQ following the configuration passed on ConsumerConfig Consumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery)) // StartConsumer starts a consumer routine listening to a Queue of RabbitMQ // following the configuration passed on ConsumerConfig. // // There is a DEFAULT_MAX_RECONNECT_TIMES variable that defines on 3 the number of retries to reconnect to the // RabbitMQ service currently running. You can define this number by setting an env variable called // SRV_RMQ_MAXX_RECONNECT_TIMES StartConsumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery)) GetAmqpConnection() *amqp.Connection GetAmqpChannel() *amqp.Channel }
func New ¶
func New(conf *config.Config) RabbitInterface
type Rbm_pool ¶
type Rbm_pool struct { Channel *amqp.Channel MAXX_RECONNECT_TIMES int // contains filtered or unexported fields }
func (*Rbm_pool) CloseConnection ¶
func (*Rbm_pool) CompleteDeclare ¶
func (*Rbm_pool) CompleteExchangeDeclare ¶
func (*Rbm_pool) CompleteQueueDeclare ¶
func (*Rbm_pool) Connect ¶
func (rbm *Rbm_pool) Connect() (RabbitInterface, error)
func (*Rbm_pool) Consumer ¶
func (rbm *Rbm_pool) Consumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery))
func (*Rbm_pool) GetAmqpChannel ¶
func (*Rbm_pool) GetAmqpConnection ¶
func (rbm *Rbm_pool) GetAmqpConnection() *amqp.Connection
func (*Rbm_pool) GetConnect ¶
func (*Rbm_pool) GetConnectStatus ¶
func (*Rbm_pool) SimpleExchangeDeclare ¶
func (*Rbm_pool) SimpleQueueDeclare ¶
func (*Rbm_pool) StartConsumer ¶
func (rbm *Rbm_pool) StartConsumer(cc *ConsumerConfig, callback func(msg *amqp.Delivery))
Click to show internal directories.
Click to hide internal directories.