Module: Qwirk::Remote
- Defined in:
- lib/qwirk/remote.rb,
lib/qwirk/remote/client.rb,
lib/qwirk/remote/worker.rb
Defined Under Namespace
Class Method Summary collapse
- .adapter_factory ⇒ Object
- .default_name ⇒ Object
- .name ⇒ Object
- .queue_name(name) ⇒ Object
- .remote_name(worker_name) ⇒ Object
- .root_bean ⇒ Object
-
.setup(adapter_factory, options = {}) ⇒ Object
Setup the remote worker with a unique name with which to identify this particular process.
- .topic_name ⇒ Object
Class Method Details
.adapter_factory ⇒ Object
32 33 34 |
# File 'lib/qwirk/remote.rb', line 32 def self.adapter_factory @@adapter_factory end |
.default_name ⇒ Object
52 53 54 55 56 |
# File 'lib/qwirk/remote.rb', line 52 def self.default_name require 'socket' name = Socket.gethostname name.sub(/\..*/, '') end |
.name ⇒ Object
36 37 38 |
# File 'lib/qwirk/remote.rb', line 36 def self.name @@name end |
.queue_name(name) ⇒ Object
44 45 46 |
# File 'lib/qwirk/remote.rb', line 44 def self.queue_name(name) "Remote_#{name}" end |
.remote_name(worker_name) ⇒ Object
58 59 60 |
# File 'lib/qwirk/remote.rb', line 58 def self.remote_name(worker_name) worker_name.sub(/^[QT]Remote_/, '') end |
.root_bean ⇒ Object
48 49 50 |
# File 'lib/qwirk/remote.rb', line 48 def self.root_bean @@root_bean end |
.setup(adapter_factory, options = {}) ⇒ Object
Setup the remote worker with a unique name with which to identify this particular process. This defaults to the simple hostname (minus the domain name) which can be used if their is only one qwirk_manager running on this host, otherwise it should be some combination of the hostname and process name or anything that would uniquely identify the process/host combination. Options:
name - overrides the default name for this process/host combination.
topic_name - name of the topic. This should be the same for all process/host combinations and
defaults to 'remote'
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/qwirk/remote.rb', line 12 def self.setup(adapter_factory, ={}) require 'qwirk/remote/client' require 'qwirk/remote/worker' = .dup @@adapter_factory = adapter_factory @@name = .delete(:name) || default_name @@topic_name = .delete(:topic_name) || 'remote' @@queue_name = self.queue_name(@@name) @@root_bean_name = .delete(:root_bean_name) || @@topic_name = {:min_count => 1, :max_count => 1} Worker.define_configs( "TRemote_#{@@name}" => .merge(:topic_name => @@topic_name).merge(), "QRemote_#{@@name}" => .merge(:queue_name => @@queue_name).merge() ) client = Client.new(adapter_factory, ) @@root_bean = Rumx::Bean.add_root(@@root_bean_name, ::Rumx::Beans::Folder.new) @@root_bean.bean_add_child(:client, client) end |
.topic_name ⇒ Object
40 41 42 |
# File 'lib/qwirk/remote.rb', line 40 def self.topic_name @@topic_name end |