
On December 17, 2022 7:53:39 AM UTC, Henry R via ruby-talk <ruby-talk@ml.ruby-lang.org> wrote:
... my program quit early. I don't know if it's due to somewhat async operations.
the code is like (connection to rabbitmq),
100.times do |s| exchange.publish(s.to_s) end
It can't publish the entire 100 items to the broker, just some items.
Take a look at: https://github.com/ruby-amqp/bunny/issues/611 Q: "the script below, which should publish 100000 messages, iteratatively with 3 seconds pause. Then the number of messages subscriber receives fluctuates. The fluctuation looks like random, e.g. [99804, 99815, 99809, 99836, 99823, 99864, 99815, 99809, 999821] and so on." A: "The code in this example does not use publisher confirms. Data safety is a joint responsibility of RabbitMQ nodes and your own code. See Publisher Data Safety." https://www.rabbitmq.com/publishers.html#data-safety https://www.rabbitmq.com/confirms.html#publisher-confirms