Sha256: 9a5f84ea1b911c5bd29bef883f1a5a083a6fb53df81ba21fb64ae68759d0f474

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

require 'poseidon'
require 'securerandom'
require 'citrus/event_bus/configuration'

module Citrus
  module EventBus
    class Publisher

      def initialize(configuration = Configuration.new)
        @configuration = configuration
        @producer      = Poseidon::Producer.new([@configuration.connection_string], SecureRandom.uuid)
      end

      def call(event)
        message = Poseidon::MessageToSend.new(
            @configuration.topic,
            @configuration.event_serializer.dump(event)
        )
        @producer.send_messages([message])
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citrus-event-bus-0.0.1 lib/citrus/event_bus/publisher.rb