longears
longears copied to clipboard
Can't get Direct Reply-to to work
For Sending and immediatly receiving messages, RabbitMQ has the Direct Reply-To feature: https://www.rabbitmq.com/direct-reply-to.html
I can't get it to work with this code, even though there's no error in the consumer or the queue and the message is sent back:
library(longears)
conn <- amqp_connect()
consumer <- amqp_consume(
conn = conn,
no_ack = TRUE,
# prefetch_count = 1,
timeout = 15,
queue = "amq.rabbitmq.reply-to",
fun = function(msg) {
received <<- received + 1
})
amqp_publish(conn, '{"content":1707163749285}', exchange = "", routing_key = "QUEUE_NAME", properties=amqp_properties(content_type="application/json", reply_to="amq.rabbitmq.reply-to.bdwkehdwhecbhjwe", delivery_mode=2))
while (TRUE) {
amqp_listen(conn, timeout = 15)
}