Sha256: d02923ce80b78a540295216952a3340e85f2ce843374a376eaba5008b3ba6ab9

Contents?: true

Size: 861 Bytes

Versions: 28

Compression:

Stored size: 861 Bytes

Contents

# frozen_string_literal: true

module Deimos
  # Abstract class for all publish backends.
  class PublishBackend
    class << self
      # @param producer_class [Class < Deimos::Producer]
      # @param messages [Array<Deimos::Message>]
      def publish(producer_class:, messages:)
        Deimos.config.logger.info(
          message: 'Publishing messages',
          topic: producer_class.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>]
      def execute(producer_class:, messages:)
        raise NotImplementedError
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 2 rubygems

Version Path
deimos-ruby-1.3.0.pre.beta5 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta7 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta6 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta5 lib/deimos/publish_backend.rb
deimos-ruby-1.3.0.pre.beta4 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta4 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta3 lib/deimos/publish_backend.rb
deimos-ruby-1.3.0.pre.beta3 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta2 lib/deimos/publish_backend.rb
deimos-ruby-1.4.0.pre.beta1 lib/deimos/publish_backend.rb
deimos-ruby-1.3.0.pre.beta2 lib/deimos/publish_backend.rb
deimos-ruby-1.3.0.pre.beta1 lib/deimos/publish_backend.rb
deimos-ruby-1.2.0.pre.beta1 lib/deimos/publish_backend.rb
deimos-ruby-1.1.0.pre.beta2 lib/deimos/publish_backend.rb
deimos-ruby-1.1.0.pre.beta1 lib/deimos/publish_backend.rb
deimos-ruby-1.0.0 lib/deimos/publish_backend.rb
deimos-ruby-1.0.0.pre.beta26 lib/deimos/publish_backend.rb
deimos-ruby-1.0.0.pre.beta25 lib/deimos/publish_backend.rb
deimos-ruby-1.0.0.pre.beta24 lib/deimos/publish_backend.rb
deimos-ruby-1.0.0.pre.beta23 lib/deimos/publish_backend.rb