Class: Deimos::Backends::KafkaAsync

Inherits:
Base
  • Object
show all
Defined in:
lib/deimos/backends/kafka_async.rb

Overview

Backend which produces to Kafka via an async producer.

Class Method Summary collapse

Methods inherited from Base

publish

Class Method Details

.execute(producer_class:, messages:) ⇒ Object

:nodoc:



8
9
10
11
12
13
14
15
# File 'lib/deimos/backends/kafka_async.rb', line 8

def self.execute(producer_class:, messages:)
  Karafka.producer.produce_many_async(messages)
  Deimos.config.metrics&.increment(
    'publish',
    tags: %W(status:success topic:#{messages.first[:topic]}),
    by: messages.size
  )
end