Categorygithub.com/kelchy/go-lib/rmq/consumer
modulepackage
0.1.2
Repository: https://github.com/kelchy/go-lib.git
Documentation: pkg.go.dev

# README

RMQ Consumer

This library is a wrapper around RMQ functions to make interaction with RMQ simpler and safer. Functionality is tested with hosted CloudAMQP, which offers automated failover using connection with a single URI.

Adapted from go-rabbitmq

Quickstart

Refer to example/consumer.example.go to see how to setup your own consumer

# Packages

No description provided by the author

# Functions

DeclareBinding declares the binding in the given options.
DeclareExchange declares all exchanges in the given options.
DeclareQueue declares the queue in the given options.
NewConn creates a new connection manager.
NewConsumer returns a new Consumer connected to the given rabbitmq server it also starts consuming on the given connection with automatic reconnection handling Do not reuse the returned consumer for anything other than to close it.
WithConnectionOptionsConfig sets the Config used in the connection.
WithConnectionOptionsLogger sets logging to true on the consumer options and sets the.
WithConnectionOptionsLogging sets logging to true on the consumer options and sets the.
WithConnectionOptionsReconnectInterval sets the reconnection interval.
WithConsumerOptionsBinding adds a new binding to the queue which allows you to set the binding options on a per-binding basis.
WithConsumerOptionsConcurrency returns a function that sets the concurrency, which means that many goroutines will be spawned to run the provided handler on messages.
WithConsumerOptionsConsumerAutoAck returns a function that sets the auto acknowledge property on the server of this consumer if unset the default will be used (false).
WithConsumerOptionsConsumerDlxRetry sets the consumer to retry using dlx, which means it will retry failed messages by queuing them up again on the dlx exchange this is useful if you want to retry messages after a delay and have set up a dlx exchange with a ttl on the queue.
WithConsumerOptionsConsumerExclusive sets the consumer to exclusive, which means the server will ensure that this is the sole consumer from this queue.
WithConsumerOptionsConsumerName returns a function that sets the name on the server of this consumer if unset a random name will be given.
WithConsumerOptionsConsumerNoWait sets the consumer to nowait, which means it does not wait for the server to confirm the request and immediately begin deliveries.
WithConsumerOptionsConsumerRetry sets the consumer to retry, which means it will retry failed messages instantly by queuing them up again on the same routing key Only use this if you have a quorum queue since poison messages will be requeued.
WithConsumerOptionsConsumerRetryLimit sets the consumer to the retry limit, which means it will retry failed messages up to the limit and then drop them.
WithConsumerOptionsExchangeArgs adds optional args to the exchange.
WithConsumerOptionsExchangeAutoDelete ensures the exchange is an auto-delete exchange.
WithConsumerOptionsExchangeDeclare stops this library from declaring the exchanges existance.
WithConsumerOptionsExchangeDurable ensures the exchange is a durable exchange.
WithConsumerOptionsExchangeInternal ensures the exchange is an internal exchange.
WithConsumerOptionsExchangeKind ensures the queue is a durable queue.
WithConsumerOptionsExchangeName sets the exchange name.
WithConsumerOptionsExchangeNoWait ensures the exchange is a no-wait exchange.
WithConsumerOptionsExchangePassive ensures the exchange is a passive exchange.
WithConsumerOptionsLogger sets logging to a custom interface.
WithConsumerOptionsLogging uses a default logger that writes to std out.
WithConsumerOptionsQOSGlobal sets the qos on the channel to global, which means these QOS settings apply to ALL existing and future consumers on all channels on the same connection.
WithConsumerOptionsQOSPrefetch returns a function that sets the prefetch count, which means that many messages will be fetched from the server in advance to help with throughput.
WithConsumerOptionsQueueArgs adds optional args to the queue.
WithConsumerOptionsQueueAutoDelete ensures the queue is an auto-delete queue.
WithConsumerOptionsQueueDurable ensures the queue is a durable queue.
WithConsumerOptionsQueueExclusive ensures the queue is an exclusive queue.
WithConsumerOptionsQueueNoDeclare will turn off the declaration of the queue's existance upon startup.
WithConsumerOptionsQueueNoWait ensures the queue is a no-wait queue.
WithConsumerOptionsQueuePassive ensures the queue is a passive queue.
WithConsumerOptionsQueueQuorum sets the queue a quorum type, which means multiple nodes in the cluster will have the messages distributed amongst them for higher reliability.
WithConsumerOptionsRoutingKey binds the queue to a routing key with the default binding options.

# Constants

Ack default ack this msg after you have successfully processed this delivery.
Manual means message acknowledgement is left to the user using the msg.Ack() method.
NackDiscard the message will be dropped or delivered to a server configured dead-letter queue.
NackRequeue deliver this message to a different consumer.

# Structs

Binding describes the bhinding of a queue to a routing key on an exchange.
BindingDeclareOptions are used to configure a binding declaration.
BindingOptions describes the options a binding can have.
Conn manages the connection to a rabbit cluster it is intended to be shared across publishers and consumers.
ConnectionOptions are used to describe how a new consumer will be created.
Consumer allows you to create and connect to queues for data consumption.
ConsumerOptions are used to describe how a new consumer will be created.
Delivery captures the fields for a previously delivered message resident in a queue to be delivered by the server to a consumer from Channel.Consume or Channel.Get.
ExchangeOptions are used to configure an exchange.
QueueOptions are used to configure a queue.
RabbitConsumerOptions are used to configure the consumer on the rabbit server.

# Type aliases

Action is an action that occurs after processed this delivery.
Config wraps amqp.Config Config is used in DialConfig and Open to specify the desired tuning parameters used during a connection open handshake.
EventHandler defines the handler of each Delivery and returns error if any.
Handler defines the handler of each Delivery and return Action.
Table stores user supplied fields of the following types: bool byte float32 float64 int int16 int32 int64 nil string time.Time amqp.Decimal amqp.Table []byte []interface{} - containing above types Functions taking a table will immediately fail when the table contains a value of an unsupported type.