Sha256: 173061be0334d9380041634cb1ad13e7610f6d4b935feef995af8a490b091f36
Contents?: true
Size: 755 Bytes
Versions: 9
Compression:
Stored size: 755 Bytes
Contents
# frozen_string_literal: true require 'deimos/kafka_message' module Deimos module Backends # Backend which saves messages to the database instead of immediately # sending them. class Db < Deimos::PublishBackend class << self # :nodoc: def execute(producer_class:, messages:) records = messages.map do |m| message = Deimos::KafkaMessage.new( message: m.encoded_payload.to_s.b, topic: m.topic, partition_key: m.partition_key || m.key ) message.key = m.encoded_key.to_s.b unless producer_class.config[:no_keys] message end Deimos::KafkaMessage.import(records) end end end end end
Version data entries
9 entries across 9 versions & 2 rubygems