Sha256: e36986de065da7a0e412697c9791262b78d9503a293a245014dfedb6c201e46b
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
# frozen_string_literal: true require 'semaphore' module RubyRabbitmqJanus module Rabbit # Define an module for create an publisher module Publisher # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv> # # Parent class for all publisher # This element send and read a message in rabbitmq Queue # # @!attribute [r] response # @return [RubyRabbitmqJanus::Janus::Responses::Response] # Given a Janus response # # @abstract Publish message in RabbitMQ class BasePublisher attr_reader :responses # Define a base publisher def initialize Tools::Log.instance.debug 'Create an publisher' @responses = [] @semaphore= Semaphore.new @lock = Mutex.new end private attr_accessor :condition, :lock # return an response when signal is trigger def return_response Tools::Log.instance.debug 'Waiting response...' @semaphore.wait Tools::Log.instance.debug 'Response received' response = nil @lock.synchronize do response = @responses.shift end response end end end end end require 'rrj/rabbit/publish/publisher' require 'rrj/rabbit/publish/listener'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ruby_rabbitmq_janus-1.2.9 | lib/rrj/rabbit/publish/base_publisher.rb |