https://github.com/makasim/amqpextra
Golang AMQP reliable connection, publisher, consumer.
https://github.com/makasim/amqpextra
amqp consumer go golang hacktoberfest publisher rabbitmq streadway
Last synced: 7 months ago
JSON representation
Golang AMQP reliable connection, publisher, consumer.
- Host: GitHub
- URL: https://github.com/makasim/amqpextra
- Owner: makasim
- License: mit
- Created: 2019-11-05T19:39:33.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-31T10:40:38.000Z (over 1 year ago)
- Last Synced: 2025-02-27T10:35:31.397Z (8 months ago)
- Topics: amqp, consumer, go, golang, hacktoberfest, publisher, rabbitmq, streadway
- Language: Go
- Homepage:
- Size: 299 KB
- Stars: 74
- Watchers: 5
- Forks: 18
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Extra features for streadway/amqp package.
[Documentation](https://pkg.go.dev/github.com/makasim/amqpextra#section-documentation)
## Dialer.
Provides:
* Auto reconnect.
* Context aware.
* Configured by WithXXX options.
* Dial multiple servers.
* Notifies ready\unready\closed states.Examples:
* [Dialer.ConnectionCh](https://pkg.go.dev/github.com/makasim/amqpextra#example-Dialer.ConnectionCh)
* [Dialer.Consumer](https://pkg.go.dev/github.com/makasim/amqpextra#example-Dialer.Consumer)
* [Dialer.Publisher](https://pkg.go.dev/github.com/makasim/amqpextra#example-Dialer.Publisher)## Consumer.
Provides:
* Auto reconnect.
* Context aware.
* Configured by WithXXX options.
* Consumer can process messages in parallel.
* Consumers in-process auto-scaling and backpressure.
* Adds message context.
* Detects queue deletion and reconnect.
* Notifies ready\unready\closed states.Examples:
* [NewConsumer](https://pkg.go.dev/github.com/makasim/amqpextra#example-NewConsumer)
* [Wrap](https://pkg.go.dev/github.com/makasim/amqpextra@v0.16.1/consumer#example-Wrap)## Publisher.
Provides:
* Auto reconnect.
* Context aware.
* Configured by WithXXX options.
* Notifies ready\unready\closed states.
* Publish could wait till connection ready.
* Adds message context.
* Publish a message struct (define only what you need).
* Supports [flow control](https://www.rabbitmq.com/flow-control.html).Examples:
* [NewPublisher](https://pkg.go.dev/github.com/makasim/amqpextra#example-NewPublisher)#### Consumer middlewares
The consumer could chain middlewares for a preprocessing received message.
Here's some built-in middlewares:
* [HasCorrelationID](consumer/middleware/has_correlation_id.go) - Nack message if has no correlation id
* [HasReplyTo](consumer/middleware/has_reply_to.go) - Nack message if has no reply to.
* [Logger](consumer/middleware/logger.go) - Context with logger.
* [Recover](consumer/middleware/recover.go) - Recover worker from panic, nack message.
* [Expire](consumer/middleware/expire.go) - Convert Message expiration to context with timeout.
* [AckNack](consumer/middleware/ack_nack.go) - Return middleware.Ack to ack message.