Module: HomeQ

Included in:
CP::Connection, SOBS::Connection, SOBS::Queue
Defined in:
lib/homeq/cli.rb,
lib/homeq.rb,
lib/homeq/sobs/job.rb,
lib/homeq/base/base.rb,
lib/homeq/cp/server.rb,
lib/homeq/sobs/sobs.rb,
lib/homeq/base/ohash.rb,
lib/homeq/sobs/queue.rb,
lib/homeq/base/config.rb,
lib/homeq/base/logger.rb,
lib/homeq/base/system.rb,
lib/homeq/cp/commands.rb,
lib/homeq/sobs/client.rb,
lib/homeq/sobs/sender.rb,
lib/homeq/sobs/server.rb,
lib/homeq/base/options.rb,
lib/homeq/sobs/foreman.rb,
lib/homeq/sobs/message.rb,
lib/homeq/base/commando.rb,
lib/homeq/base/poolable.rb,
lib/homeq/cp/connection.rb,
lib/homeq/sobs/topology.rb,
lib/homeq/base/exception.rb,
lib/homeq/base/histogram.rb,
lib/homeq/sobs/connection.rb

Overview

$Id: homeq.rb 8 2008-08-27 20:15:22Z colin $

This code is distributed freely in the sense of GNU GPL. K.Kodama 2005-03-01


Copyright (C) 2008 by Colin Steele. All Rights Reserved.
                  [email protected]

This program is free software; you can redistribute it and/or modify it under the terms of either: 1) the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version; or 2) Ruby’s License.

See the file COPYING for complete licensing information.


Defined Under Namespace

Modules: Base, CLI, CP, HQ, Poolable, SOBS Classes: Histogram, OHash

Constant Summary collapse

VERSION =
HOMEQ_VERSION

Class Method Summary collapse

Class Method Details

.calculated_homeq_envObject



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/homeq.rb', line 47

def self.calculated_homeq_env
  if defined?(HOMEQ_APP_ROOT)
    require "#{HOMEQ_APP_ROOT}/config/environment"
  else
    require 'config/environment'
  end
  
  options = HomeQ::Base::Options::Options.instance.options
  sys = HomeQ::Base::System.instance

  options.log_level   = 'fatal'
  options.foreground  = true
  options.queue_name  = '__'

  env = nil
  sys.start {
    env = HOMEQ_ENV
    EM.next_tick {
      sys.stop
    }
  }
  env
end

.calculated_homeq_topologyObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/homeq.rb', line 71

def self.calculated_homeq_topology
  if defined?(HOMEQ_APP_ROOT)
    require "#{HOMEQ_APP_ROOT}/config/environment"
  else
    require 'config/environment'
  end
  
  options     = HomeQ::Base::Options::Options.instance.options
  sys         = HomeQ::Base::System.instance

  if sys.topology.queues.any?
    return sys.topology 
  end
  
  options.log_level   = 'fatal'
  options.foreground  = true
  options.queue_name  = '__'
  topology = nil
  sys.start {
    topology = sys.topology
    sys.stop
  }
  topology
end

.included(base) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/homeq.rb', line 39

def self.included(base)
  base.class_eval {
    include(HomeQ::HQ)
    include(HomeQ::Base::Configuration)
    include(HomeQ::Base::Logging)
  }
end

.queue_list_for_host_from_topology(some_hostname = `hostname`.chomp) ⇒ Object



96
97
98
99
100
101
102
103
104
# File 'lib/homeq.rb', line 96

def self.queue_list_for_host_from_topology(some_hostname = `hostname`.chomp)
  queues_for_this_host = []
  self.
    calculated_homeq_topology.queues.
    values.each { |queue_name, host, port, hostname|
    queues_for_this_host << queue_name if hostname == some_hostname
  }
  queues_for_this_host
end