Sha256: 61e898ac63e2c1299958ae8c32e885dbba2c636019141306691e27bfc1d2bb0a
Contents?: true
Size: 901 Bytes
Versions: 38
Compression:
Stored size: 901 Bytes
Contents
# frozen_string_literal: true module Deimos module Backends # Backend which produces to Kafka via an async producer. class KafkaAsync < Base include Phobos::Producer # Shut down the producer cleanly. # @return [void] def self.shutdown_producer producer.async_producer_shutdown producer.kafka_client&.close end # :nodoc: def self.execute(producer_class:, messages:) Deimos.instrument( 'produce', producer: producer_class, topic: producer_class.topic, payloads: messages.map(&:payload) ) do producer.async_publish_list(messages.map(&:encoded_hash)) Deimos.config.metrics&.increment( 'publish', tags: %W(status:success topic:#{producer_class.topic}), by: messages.size ) end end end end end
Version data entries
38 entries across 38 versions & 1 rubygems