ruby on rails - Hutch & RabbitMQ: set timeout on re-queued messages -
when hutch consumer loses connection database requeue messages got , try handle (and save db) them later.
i found can use requeue! method in consumer:
def process(message) handle_message(message) rescue activerecord::connectionnotestablished => error rails.logger.warn("connection database broken: #{error}") requeue! ensure ::activerecord::base.clear_active_connections! end end
but message instantly rabbit, , so, consumer stuck in trying process message when it's can't saved db.
is possible put timeout on either hutch or rabbitmq site in situation?
as answered here https://github.com/gocardless/hutch/issues/161
not without using scheduled delivery exchange, or abusing ttl , dead lettering.
Comments
Post a Comment