c# - Can I set an explicit task timeout for RabbitMQ consumer? -
i understand rabbitmq ack, default, re-queue message if detects consumer/worker has died.
what situation consumer/worker still alive process has stalled out long , didn't ack?
i set explicit time says if message has been dispatched consumer consumer has held message without ack long message gets re-queued.
i recognize might result in messages getting processed in duplicate consequence of not bad delayed message delivery. can happen errant exception handling if swallowed, task terminates, , message never ack'd , never re-queued.
timeout rabbitmq consumer explicitly set on consumer side. think clear mention - there must not automatic acks in case. solution consumer multithreaded 1 thread doing message processing , acking message after has been processed, , other thread being timeout thread would:
- terminate connection broker once timeout has expired, , consequence message requeued
- ack received message , re-publish (explicitly)
- nack received message, based on documentation (
instructing broker either discard them or requeue them
), seems config should set instructing broker should nacked messages
now implies @ least part of process isn't stuck. if whole process stuck, perhaps broker heartbeat towards consumer stopped , how broker knows consumer died (honestly didn't test situation, i'm assuming), if not case (or safe) add kind of watchdog process pinging consumer(s) , killing them if there's no reply, again lead messages not being acked , being requeued.
Comments
Post a Comment