class QRPC::Locator::EMJackLocator
Locator
for ‘em-jack’ (so EventMachine Beanstalk implementation) queue type.
@see github.com/dj2/em-jack @since 0.9.0
Constants
- DEFAULT_PORT
Default port.
- PARSER
Parser.
Attributes
Contains host. @return [String]
Contains port. @return [Integer]
Contains queue name. @return [String]
Public Class Methods
Constructor.
@param [String, Symbol] queue_name
queue name @param [String] host host name @param [Integer] port port of the host
# File lib/qrpc/locator/em-jack.rb, line 88 def initialize(queue_name, host = "localhost", port = 11300) @queue_name = queue_name.to_s @host = host @port = port end
Parses the locator. Excpects form +<queue>@<host>:<port>+. Port is optional.
@param [String] string locator in string form @return [QRPC::Locator] new instance
# File lib/qrpc/locator/em-jack.rb, line 102 def self.parse(string) match = string.match(self::PARSER) queue = match.first host = match.second if match.length == 3 port = match.third else port = self::DEFAULT_PORT end port = port.to_i ## return self::new(queue, host, port); end
Public Instance Methods
Returns universal queue interface for input queue. @return [UnifiedQueues::Multi] queue
# File lib/qrpc/locator/em-jack.rb, line 135 def input_queue if @input_queue.nil? @input_queue = UnifiedQueues::Multi::new EMJack::Connection, :host => @host, :port => @port else @input_queue end end
Returns universal queue interface for output queue. @return [UnifiedQueues::Multi] queue
# File lib/qrpc/locator/em-jack.rb, line 148 def output_queue if @output_queue.nil? @output_queue = UnifiedQueues::Multi::new EMJack::Connection, :host => @host, :port => @port else @output_queue end end
Converts back to string. @return [String] locator in string form
# File lib/qrpc/locator/em-jack.rb, line 126 def to_s @queue_name + "@" + @host + ":" + @port.to_s end