Queue is a Go library that gives Hub pipeline and workflow services one API for publishing, consuming, routing, retrying, and dead-lettering messages across different message brokers.
| Broker | Implementation | Guide |
|---|---|---|
| RabbitMQ | amqp091-go |
RabbitMQ guide |
| Kafka | Confluent Kafka Go client | Kafka guide |
| Azure Event Hubs | Kafka-compatible endpoint | Event Hubs guide |
| Amazon SQS | AWS SDK for Go v2 | SQS guide |
The broker guides contain provider-specific setup, configuration, security, delivery semantics, examples, and troubleshooting notes.
go get github.com/uug-ai/queueEach broker exposes a typed options builder that implements QueueOptions.
Options are validated when the client is created.
New(options) selects the broker from the concrete options type and returns a
Queue containing the validated options and a QueueInterface client.
func connect(options queue.QueueOptions) (*queue.Queue, error) {
client, err := queue.New(options)
if err != nil {
return nil, err
}
if err := client.Client.Connect(); err != nil {
return nil, err
}
return client, nil
}Call Close when the client is no longer needed.
QueueInterface provides the shared broker lifecycle and messaging operations:
Connect,Reconnect, andClosePublishandPublishWithDelayReadMessagesandRouteMessagesAddToDeadletterandDisasterRecoverySetDisasterRecoveryHandlerLoadMessages
Message handlers return a models.PipelineAction. The queue client maps that
action to broker operations:
| Action | Result |
|---|---|
PipelineForward |
Advance and publish the event to the configured router |
PipelineCancel |
Complete the message without forwarding |
PipelineRetry |
Republish with a bounded retry count |
PipelineError |
Publish to the configured dead-letter destination |
All providers implement at-least-once processing. Handlers and downstream writes should therefore be idempotent.
Use the broker-specific builder and follow its guide:
Application code can depend on QueueInterface after construction, keeping
most processing logic independent of the selected broker.
Run the complete test suite:
go test ./...Verify the non-CGO build used by RabbitMQ-only applications:
CGO_ENABLED=0 go test ./...New providers should implement QueueInterface, expose a typed options builder,
validate required configuration, and include broker-free unit tests for publish,
consume, retry, and dead-letter behavior.
This project is licensed under the MIT License. See LICENSE.