Sha256: 313b4439c2d3b774c72e8fd95ea927ba451cc15e0b5064b044e597ac99d08d8f

Contents?: true

Size: 680 Bytes

Versions: 13

Compression:

Stored size: 680 Bytes

Contents

module Refinery #:nodoc:
  # Base class for publishers to be implemented by subclasses.
  class Publisher
    include Refinery::Loggable
    
    # Initialize the publisher with the queue to publish messages to.
    def initialize(waiting_queue)
      @waiting_queue = waiting_queue
    end
    
    protected
    # Get the publish queue
    def waiting_queue
      @waiting_queue
    end
    
    # Publish the message. The message will be converted to JSON and pushed
    # into the queue associated with the publisher.
    def publish(message)
      logger.debug "Message: #{message.to_json}"
      waiting_queue.send_message(Base64.encode64(message.to_json))
    end
  end
end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
aeden-refinery-0.9.1 lib/refinery/publisher.rb
aeden-refinery-0.9.2 lib/refinery/publisher.rb
aeden-refinery-0.9.4 lib/refinery/publisher.rb
aeden-refinery-0.9.5 lib/refinery/publisher.rb
aeden-refinery-0.9.6 lib/refinery/publisher.rb
aeden-refinery-0.9.7 lib/refinery/publisher.rb
refinery-0.9.3 lib/refinery/publisher.rb
refinery-0.9.4 lib/refinery/publisher.rb
refinery-0.9.5 lib/refinery/publisher.rb
refinery-0.9.6 lib/refinery/publisher.rb
refinery-0.9.7 lib/refinery/publisher.rb
refinery-0.9.0 lib/refinery/publisher.rb
refinery-0.9.2 lib/refinery/publisher.rb