Sha256: 7759d69f02c59ecf45b11a42c00ab0c872365d0faa1ef49e214425b1699aaa69

Contents?: true

Size: 943 Bytes

Versions: 4

Compression:

Stored size: 943 Bytes

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Rabbit
    # Define an module for create an publisher
    module Publisher
      # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
      # @abstract Publish message in RabbitMQ
      class BasePublisher
        attr_reader :response

        # Define a base publisher
        def initialize
          Tools::Log.instance.debug 'Create an publisher'
          @response = nil
          @condition = ConditionVariable.new
          @lock = Mutex.new
        end

        private

        attr_accessor :condition, :lock

        # return an response when signal is trigger
        def return_response
          Tools::Log.instance.debug 'Response received'
          @lock.synchronize do
            @condition.wait(@lock)
            @response
          end
        end
      end
    end
  end
end

require 'rrj/rabbit/publish/publisher'
require 'rrj/rabbit/publish/listener'

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-1.0.6 lib/rrj/rabbit/publish/base_publisher.rb
ruby_rabbitmq_janus-1.0.5 lib/rrj/rabbit/publish/base_publisher.rb
ruby_rabbitmq_janus-1.0.4 lib/rrj/rabbit/publish/base_publisher.rb
ruby_rabbitmq_janus-1.0.3 lib/rrj/rabbit/publish/base_publisher.rb