Sha256: 2632818a433293fa17a86b5effe2787b07a378643caf7dacc9ecd9effd808484

Contents?: true

Size: 907 Bytes

Versions: 3

Compression:

Stored size: 907 Bytes

Contents

module SmartQue
  module Publishers
    class Base
      # List Queues from configuration
      def queue_list
        @queue_list ||= ::SmartQue.config.queues
      end

      # Methods related to bunny exchange, channels, queues
      def channel
        @channel ||= connection.create_channel
      end

      # Direct exchange
      def x_direct
        @x_direct ||= channel.direct("smartque.direct")
      end

      # Connection Object
      def connection
        ::SmartQue.establish_connection
      end

      # Get/Set queue with name
      # name : sms_otp
      def get_queue(q_name)
        channel.queue(modified_q_name(q_name))
      end

      # Logging
      def log_message(data)
        ::SmartQue.log(data)
      end

      def config
        ::SmartQue.config
      end

      private

      def modified_q_name(q_name)
        q_name.downcase.sub('_','.')
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
smart-que-0.2.0 lib/smart_que/publishers/base.rb
smart-que-0.1.2 lib/smart_que/publishers/base.rb
smart-que-0.1.1 lib/smart_que/publishers/base.rb