Sha256: 015296ec539493b4529259428d97b5272aec2eaaf70d1bea7ea659b9f259b12b

Contents?: true

Size: 665 Bytes

Versions: 1

Compression:

Stored size: 665 Bytes

Contents

module Rocketman
  class Bridge
    include Rocketman::Producer

    attr_reader :service

    def initialize(service)
      @service = service
    end

    def self.construct(service)
      instance = new(service)

      case instance.service.class.to_s
      when "Redis"
        puts "Rocketman> Using Redis as external producer".freeze
        Thread.new do
          instance.service.psubscribe("*") do |on|
            on.pmessage do |_pattern, event, payload|
              instance.emit(event, payload)
            end
          end
        end
      else
        puts "Rocketman> Don't know how to handle service: `#{service}`"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocketman-0.2.0 lib/rocketman/bridge.rb