Sha256: 3efc2d0a30cd3f7c4d30f07269424fe3452bf7ab275331f720cab881d24f6b39
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
module ManageIQ module Messaging module Kafka module Queue private def publish_message_impl(options) raise ArgumentError, "Kafka messaging implementation does not take a block" if block_given? raw_publish(true, *queue_for_publish(options)) end def publish_messages_impl(messages) messages.each { |msg_options| raw_publish(false, *queue_for_publish(msg_options)) } producer.deliver_messages end def subscribe_messages_impl(options) topic = address(options) consumer = queue_consumer consumer.subscribe(topic) consumer.each_batch(:automatically_mark_as_processed => auto_ack?(options)) do |batch| logger.info("Batch message received: queue(#{topic})") begin messages = batch.messages.collect do |message| sender, message_type, _class_name, payload = process_queue_message(topic, message) ManageIQ::Messaging::ReceivedMessage.new(sender, message_type, payload, message) end yield messages rescue StandardError => e logger.error("Event processing error: #{e.message}") logger.error(e.backtrace.join("\n")) end logger.info("Batch message processed") end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
manageiq-messaging-0.1.1 | lib/manageiq/messaging/kafka/queue.rb |