ruby on rails - RabbitMq(bunny): Rabbitmq deleting message from queue . acknowledgement not working -
i processing records rabbitmq. in order avoid loss of messages rabbitmq using rabbitmq acknowledgment strategey. testing purpose have raises exception before code gave acknowledgment rabbitmq. per code have written rabbitmq should not delete message queue untile line in code i.e "c.ack(delivery_info.delivery_tag)" executed. below code
begin messageservice.with_channel |c| queue = c.queue(queue_name, :durable => true) exchange = c.topic(topic_name, :durable => true) queue.bind(exchange, :routing_key => "#{routing_key_prefix}.#") available_messages = queue.message_count processed_messages = 0 fact_object = {} while queue.message_count > 0 && processed_messages <= message_limit queue.pop(:manual_ack => true) |delivery_info, properties, payload| rad_exam_hash_object = json.parse(payload) entity_manager,criteria = self.query_revenue_cost_calculation(rad_exam_hash_object) fact_object = self.revenue_cost_calculation_result(entity_manager,criteria) self.insert_data_into_table(fact_object) raise "exception" c.ack(delivery_info.delivery_tag) end processed_messages = processed_messages + 1 available_messages = processed_messages - 1 end [processed_messages, available_messages,fact_object] end rescue puts "got exception while processing messages" end
please me in undestnding why rabbitmq deleting message queue if line "c.ack(delivery_info.delivery_tag)" not executed.
disclaimer: don't know ruby. messages deleted queue:
- if queue deleted
- if acknowledged
- if message ttl expires.
so if it's non of that, maybe it's in way pop
works. sounds calling amqps get
, (based on tutorials) subscribe
seems calling amqps consume
.
Comments
Post a Comment