A delayed queue base rabbitmq, use the rabbitmq_delayed_message_exchange's plugin.
We also handle a disconnection and reconnection of rabbitmq trying every 5 sec if a new connection is available.
Start up rabbitmq in local.
docker compose up -d
You can publish the message by calling publish()
publisher, err := queue.NewPublisher(
"amqp://admin:password@localhost:5672/",
queue.WithPublisherOptionsExchange("test"),
queue.WithPublisherOptionsQueue("test"),
queue.WithPublisherOptionsKey("test"),
)
if err != nil {
fmt.Printf("%+v", err)
}
defer publisher.Disconnect()
err = publisher.Publish([]byte("Hello"), 3*time.Second)
if err != nil {
fmt.Printf("%+v", err)
}
comsumer, err := queue.NewComsumer(
"amqp://admin:password@localhost:5672/",
queue.WithComsumerOptionsExchange("test"),
queue.WithComsumerOptionsQueue("test"),
queue.WithComsumerOptionsKey("test"),
)
if err != nil {
fmt.Printf("%+v", err)
}
defer comsumer.Disconnect()
deliveries := comsumer.Consume()
for d := range deliveries {
log.Printf("Received a message: %s", d.Body)
}
Please open an issue here.