Close the channel that the unacked messages reside on, which requires you to add the messages back to the queue into a ready state. Then, purge the queue. The channel related to a consumer can be seen by pressing the queue with unacked messages.
Recent versions of RabbitMQ include the ability to configure a consumer timeout, which is the maximum time a consumer can spend processing a message before the channel is terminated.
If a consumer does not ack its delivery for more than the timeout value (30
minutes by default), its channel will be closed with a
PRECONDITION_FAILED
channel exception.
The timeout value is configurable in [rabbitmq.conf] (in milliseconds):
# 30 minutes in milliseconds
consumer_timeout = 1800000