Sha256: c21948f0cf3bf5a346a81e2f0535c83d55a64ce74d6d98c1b16342aad5826c6b

Contents?: true

Size: 717 Bytes

Versions: 10

Compression:

Stored size: 717 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 "Publisher #{self.class.name} sending message: #{message.to_json}"
      waiting_queue.send_message(Base64.encode64(message.to_json))
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
aeden-refinery-0.9.10 lib/refinery/publisher.rb
aeden-refinery-0.9.11 lib/refinery/publisher.rb
aeden-refinery-0.9.12 lib/refinery/publisher.rb
aeden-refinery-0.9.8 lib/refinery/publisher.rb
aeden-refinery-0.9.9 lib/refinery/publisher.rb
refinery-0.9.8 lib/refinery/publisher.rb
refinery-0.9.9 lib/refinery/publisher.rb
refinery-0.9.10 lib/refinery/publisher.rb
refinery-0.9.11 lib/refinery/publisher.rb
refinery-0.9.12 lib/refinery/publisher.rb