Sha256: 254d93380645bff785952b5cbf3122af07972efd621b44de9cbf8a185aa4fb79

Contents?: true

Size: 974 Bytes

Versions: 12

Compression:

Stored size: 974 Bytes

Contents

# frozen_string_literal: true

module Deimos
  module Backends
    # Abstract class for all publish backends.
    class Base
      class << self
        # @param producer_class [Class<Deimos::Producer>]
        # @param messages [Array<Deimos::Message>]
        # @return [void]
        def publish(producer_class:, messages:)
          Deimos.config.logger.info(
            message: 'Publishing messages',
            topic: messages.first&.topic,
            payloads: messages.map do |message|
              {
                payload: message.payload,
                key: message.key
              }
            end
          )
          execute(producer_class: producer_class, messages: messages)
        end

        # @param producer_class [Class<Deimos::Producer>]
        # @param messages [Array<Deimos::Message>]
        # @return [void]
        def execute(producer_class:, messages:)
          raise NotImplementedError
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
deimos-ruby-1.19.4 lib/deimos/backends/base.rb
deimos-ruby-1.19.3 lib/deimos/backends/base.rb
deimos-ruby-1.19.2 lib/deimos/backends/base.rb
deimos-ruby-1.19.1 lib/deimos/backends/base.rb
deimos-ruby-1.19.1.pre.beta1 lib/deimos/backends/base.rb
deimos-ruby-1.19.0 lib/deimos/backends/base.rb
deimos-ruby-1.19.beta2 lib/deimos/backends/base.rb
deimos-ruby-1.19.beta1 lib/deimos/backends/base.rb
deimos-ruby-1.18.2 lib/deimos/backends/base.rb
deimos-ruby-1.18.1 lib/deimos/backends/base.rb
deimos-ruby-1.18.0 lib/deimos/backends/base.rb
deimos-ruby-1.17.1 lib/deimos/backends/base.rb