crash - How to make message auto retry when using Rabbitmq and set ttl = 0? -
we have scenario this:
there may many workers (a.k.a consumers) in several nodes, @ meanwhile, webapp submit online jobs these workers. need process these jobs evenly , know if there available workers each single job. therefore, want use rabbitmq schedule jobs , set each job message ttl = 0
notice if there no worker each job. want rabbitmq handle job rescheduling when worker node crashing. however, if ttl
set 0, rabbitmq drop job message @ worker crashing or network failed.
i know can use dlx handle dead messages, fussy build module handle these exceptions cause must make high availability it. important can not distinguish scheduling failure , rescheduling faiture, different handle!
do guys have other ideas?
rabbitmq cannot explicitly know if there available workers, consumers is. knows how many consumers consuming queue, or connected etc. if have 5 workers, getting messages in round-robin fashion, described in tutorial. part
but want rabbitmq handle job rescheduling when worker node crashing
simply don't use auto-ack, rather manual ack once job finished (actually described in aforementioned tutorial). if workers dies, message not acked , gets "re-queued".
the important can not distinguish scheduling failure , rescheduling faiture, different handle!
now bit complicated , depending on use case and/or how want handle types of failures. not ack, kill consumer, if message bad, next consumer , same , go on forever. forward message (maybe add additional info) question (maybe log , that's it?) etc.
Comments
Post a Comment