bsl-thor 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +43 -0
- data/LICENSE.txt +20 -0
- data/Manifest +34 -0
- data/README +0 -0
- data/README.rdoc +18 -0
- data/Rakefile +12 -0
- data/app/amqp2sql.rb +107 -0
- data/bsl-thor.gemspec +29 -0
- data/lib/BslThor.rb +13 -0
- data/lib/ThorApplication.rb +139 -0
- data/lib/ThorClient.rb +319 -0
- data/lib/ThorCmd.rb +85 -0
- data/lib/ThorJob.rb +146 -0
- data/lib/ThorMaster.rb +226 -0
- data/lib/ThorNode.rb +203 -0
- data/lib/ThorUtils.rb +40 -0
- data/lib/ThorWorker.rb +58 -0
- data/lib/boot/Boot.rb +72 -0
- data/lib/boot/Client.rb +25 -0
- data/lib/boot/Master.rb +26 -0
- data/lib/boot/Node.rb +16 -0
- data/lib/config/ThorClient.yml.template +12 -0
- data/lib/config/ThorCmd.yml.template +4 -0
- data/lib/config/ThorMaster.yml.template +19 -0
- data/lib/config/ThorNode.yml.template +7 -0
- data/lib/config/ThorWorker.yml.template +4 -0
- data/lib/jobs/Client-0.0.1/main.rb +32 -0
- data/lib/jobs/Master-0.0.1/main.rb +32 -0
- data/lib/jobs/MonitorClient-0.0.1/main.rb +74 -0
- data/lib/jobs/MonitorMaster-0.0.1/main.rb +90 -0
- data/lib/jobs/Node-0.0.1/main.rb +56 -0
- data/lib/models/ThorModelClient.rb +9 -0
- data/lib/models/ThorModelJob.rb +9 -0
- data/lib/models/ThorModelWorker.rb +9 -0
- metadata +132 -0
data/Gemfile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
source "http://gems.github.com"
|
3
|
+
|
4
|
+
# Add dependencies required to use your gem here.
|
5
|
+
# Example:
|
6
|
+
# gem "activesupport", ">= 2.3.5"
|
7
|
+
|
8
|
+
# Gems related
|
9
|
+
gem "echoe"
|
10
|
+
gem "gemcutter"
|
11
|
+
|
12
|
+
# Amqp Gems
|
13
|
+
gem 'amqp'
|
14
|
+
#require 'mq'
|
15
|
+
|
16
|
+
# Event machine
|
17
|
+
gem 'eventmachine'
|
18
|
+
|
19
|
+
gem 'activerecord'
|
20
|
+
gem 'pg'
|
21
|
+
|
22
|
+
# http://sysutils.rubyforge.org/
|
23
|
+
# http://rubyforge.org/projects/sysutils
|
24
|
+
gem 'sys-admin'
|
25
|
+
gem 'sys-proctable'
|
26
|
+
gem 'sys-uname'
|
27
|
+
gem 'sys-cpu'
|
28
|
+
gem 'sys-uptime'
|
29
|
+
gem 'net-proto'
|
30
|
+
gem 'sys-host'
|
31
|
+
gem 'sys-filesystem'
|
32
|
+
|
33
|
+
# Custom
|
34
|
+
gem 'bsl'
|
35
|
+
|
36
|
+
# Add dependencies to develop your gem here.
|
37
|
+
# Include everything needed to run rake, tests, features, etc.
|
38
|
+
group :development do
|
39
|
+
gem "shoulda", ">= 0"
|
40
|
+
gem "bundler", "~> 1.0.0"
|
41
|
+
gem "jeweler", "~> 1.5.2"
|
42
|
+
gem "rcov", ">= 0"
|
43
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Black Snail Labs
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Manifest
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
Gemfile
|
2
|
+
LICENSE.txt
|
3
|
+
Manifest
|
4
|
+
README
|
5
|
+
README.rdoc
|
6
|
+
Rakefile
|
7
|
+
app/amqp2sql.rb
|
8
|
+
bsl-thor.gemspec
|
9
|
+
lib/BslThor.rb
|
10
|
+
lib/ThorApplication.rb
|
11
|
+
lib/ThorClient.rb
|
12
|
+
lib/ThorCmd.rb
|
13
|
+
lib/ThorJob.rb
|
14
|
+
lib/ThorMaster.rb
|
15
|
+
lib/ThorNode.rb
|
16
|
+
lib/ThorUtils.rb
|
17
|
+
lib/ThorWorker.rb
|
18
|
+
lib/boot/Boot.rb
|
19
|
+
lib/boot/Client.rb
|
20
|
+
lib/boot/Master.rb
|
21
|
+
lib/boot/Node.rb
|
22
|
+
lib/config/ThorClient.yml.template
|
23
|
+
lib/config/ThorCmd.yml.template
|
24
|
+
lib/config/ThorMaster.yml.template
|
25
|
+
lib/config/ThorNode.yml.template
|
26
|
+
lib/config/ThorWorker.yml.template
|
27
|
+
lib/jobs/Client-0.0.1/main.rb
|
28
|
+
lib/jobs/Master-0.0.1/main.rb
|
29
|
+
lib/jobs/MonitorClient-0.0.1/main.rb
|
30
|
+
lib/jobs/MonitorMaster-0.0.1/main.rb
|
31
|
+
lib/jobs/Node-0.0.1/main.rb
|
32
|
+
lib/models/ThorModelClient.rb
|
33
|
+
lib/models/ThorModelJob.rb
|
34
|
+
lib/models/ThorModelWorker.rb
|
data/README
ADDED
File without changes
|
data/README.rdoc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
= Thor
|
2
|
+
|
3
|
+
Thor - AMQP Based General Purpose Distribuded Framework
|
4
|
+
|
5
|
+
== Contributing to Thor
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
9
|
+
* Fork the project
|
10
|
+
* Start a feature/bugfix branch
|
11
|
+
* Commit and push until you are happy with your contribution
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2011 Black Snail Labs. See LICENSE.txt for further details.
|
18
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'echoe'
|
4
|
+
|
5
|
+
Echoe.new('bsl-thor', '0.0.2') do |p|
|
6
|
+
p.description = "Thor distributed framework"
|
7
|
+
p.url = "http://github.com/blacksnaillabs/thor"
|
8
|
+
p.author = "Black Snail Labs"
|
9
|
+
p.email = "admin@blacksnaillabs.com"
|
10
|
+
p.ignore_pattern = ["Gemfile.lock", "lib/config/*.yml", "tmp/*", "script/*", "nbproject/*", "nbproject/*/*"]
|
11
|
+
p.development_dependencies = []
|
12
|
+
end
|
data/app/amqp2sql.rb
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$KCODE="UTF8"
|
4
|
+
|
5
|
+
# Options parsing gems
|
6
|
+
require 'optparse'
|
7
|
+
require 'pp'
|
8
|
+
|
9
|
+
# YAML
|
10
|
+
require 'yaml'
|
11
|
+
|
12
|
+
# Rubygems
|
13
|
+
require 'rubygems'
|
14
|
+
|
15
|
+
# Custom gems
|
16
|
+
require File.join(File.dirname(__FILE__), './../lib/ThorApplication.rb')
|
17
|
+
require File.join(File.dirname(__FILE__), './../lib/ThorUtils.rb')
|
18
|
+
require 'Bsl'
|
19
|
+
|
20
|
+
class AppAmqp2Sql < Thor::Application
|
21
|
+
def initialize(opts = {})
|
22
|
+
super(opts)
|
23
|
+
|
24
|
+
# AMQP options
|
25
|
+
options[:amqp] = {}
|
26
|
+
options[:amqp][:host] = "localhost"
|
27
|
+
options[:amqp][:port] = 8467
|
28
|
+
options[:amqp][:user] = "guest"
|
29
|
+
options[:amqp][:password] = "guest"
|
30
|
+
options[:amqp][:vhost] = "/"
|
31
|
+
|
32
|
+
options[:sql] = {}
|
33
|
+
options[:sql][:host] = "localhost"
|
34
|
+
options[:sql][:port] = 5432
|
35
|
+
options[:sql][:user] = "guest"
|
36
|
+
options[:sql][:password] = "guest"
|
37
|
+
|
38
|
+
initialize_optparser { |opts|
|
39
|
+
# AMQP Host
|
40
|
+
opts.on( '--amqp-host STRING', "AMQP Server hostname [default: #{options[:amqp][:host]}]") do |host|
|
41
|
+
options[:amqp][:host] = host
|
42
|
+
end
|
43
|
+
|
44
|
+
# AMQP Port
|
45
|
+
opts.on('--amqp-port NUM', "AMQP Server port number [default: #{options[:amqp][:port]}]") do |port|
|
46
|
+
options[:amqp][:port] = port
|
47
|
+
end
|
48
|
+
|
49
|
+
# AMQP Username
|
50
|
+
opts.on('--amqp-user STRING', "AMQP Username [default: #{options[:amqp][:user]}]") do |user|
|
51
|
+
options[:amqp][:user] = user
|
52
|
+
end
|
53
|
+
|
54
|
+
# AMQP Password
|
55
|
+
opts.on('--amqp-password STRING', "AMQP Password [default: #{options[:amqp][:password]}]") do |password|
|
56
|
+
options[:amqp][:password] = password
|
57
|
+
end
|
58
|
+
|
59
|
+
# AMQP Vhost
|
60
|
+
opts.on('--amqp-vhost STRING', "AMQP Virtual Host [default: #{options[:amqp][:vhost]}]") do |vhost|
|
61
|
+
options[:amqp][:vhost] = vhost
|
62
|
+
end
|
63
|
+
|
64
|
+
# SQL Host
|
65
|
+
opts.on( '--sql-host STRING', "PostgreSQL Server hostname [default: #{options[:sql][:host]}]") do |host|
|
66
|
+
options[:sql][:host] = host
|
67
|
+
end
|
68
|
+
|
69
|
+
# SQL Port
|
70
|
+
opts.on('--sql-port NUM', "PostgreSQL Server port number [default: #{options[:sql][:port]}]") do |port|
|
71
|
+
options[:sql][:port] = port
|
72
|
+
end
|
73
|
+
|
74
|
+
# SQL Username
|
75
|
+
opts.on('--sql-user STRING', "PostgreSQL Username [default: #{options[:sql][:user]}]") do |user|
|
76
|
+
options[:sql][:user] = user
|
77
|
+
end
|
78
|
+
|
79
|
+
# SQL Password
|
80
|
+
opts.on('--sql-password STRING', "PostgreSQL Password [default: #{options[:sql][:password]}]") do |password|
|
81
|
+
options[:sql][:password] = password
|
82
|
+
end
|
83
|
+
}
|
84
|
+
end
|
85
|
+
|
86
|
+
def main
|
87
|
+
super()
|
88
|
+
|
89
|
+
# Run loop while exit is not requested
|
90
|
+
while(request_exit == false)
|
91
|
+
begin
|
92
|
+
amqp_start()
|
93
|
+
rescue SystemExit, Interrupt
|
94
|
+
Bsl::Logger::Log "Received interrupt, quitting!"
|
95
|
+
@request_exit = true
|
96
|
+
amqp_stop()
|
97
|
+
rescue Exception => e
|
98
|
+
amqp_handle_failure(e)
|
99
|
+
end
|
100
|
+
puts "."
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
if $0 == __FILE__
|
106
|
+
AppAmqp2Sql.new.main
|
107
|
+
end
|
data/bsl-thor.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "bsl-thor"
|
5
|
+
s.version = "0.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Black Snail Labs"]
|
9
|
+
s.date = "2011-12-19"
|
10
|
+
s.description = "Thor distributed framework"
|
11
|
+
s.email = "admin@blacksnaillabs.com"
|
12
|
+
s.extra_rdoc_files = ["LICENSE.txt", "README", "README.rdoc", "lib/BslThor.rb", "lib/ThorApplication.rb", "lib/ThorClient.rb", "lib/ThorCmd.rb", "lib/ThorJob.rb", "lib/ThorMaster.rb", "lib/ThorNode.rb", "lib/ThorUtils.rb", "lib/ThorWorker.rb", "lib/boot/Boot.rb", "lib/boot/Client.rb", "lib/boot/Master.rb", "lib/boot/Node.rb", "lib/config/ThorClient.yml.template", "lib/config/ThorCmd.yml.template", "lib/config/ThorMaster.yml.template", "lib/config/ThorNode.yml.template", "lib/config/ThorWorker.yml.template", "lib/jobs/Client-0.0.1/main.rb", "lib/jobs/Master-0.0.1/main.rb", "lib/jobs/MonitorClient-0.0.1/main.rb", "lib/jobs/MonitorMaster-0.0.1/main.rb", "lib/jobs/Node-0.0.1/main.rb", "lib/models/ThorModelClient.rb", "lib/models/ThorModelJob.rb", "lib/models/ThorModelWorker.rb"]
|
13
|
+
s.files = ["Gemfile", "LICENSE.txt", "Manifest", "README", "README.rdoc", "Rakefile", "app/amqp2sql.rb", "lib/BslThor.rb", "lib/ThorApplication.rb", "lib/ThorClient.rb", "lib/ThorCmd.rb", "lib/ThorJob.rb", "lib/ThorMaster.rb", "lib/ThorNode.rb", "lib/ThorUtils.rb", "lib/ThorWorker.rb", "lib/boot/Boot.rb", "lib/boot/Client.rb", "lib/boot/Master.rb", "lib/boot/Node.rb", "lib/config/ThorClient.yml.template", "lib/config/ThorCmd.yml.template", "lib/config/ThorMaster.yml.template", "lib/config/ThorNode.yml.template", "lib/config/ThorWorker.yml.template", "lib/jobs/Client-0.0.1/main.rb", "lib/jobs/Master-0.0.1/main.rb", "lib/jobs/MonitorClient-0.0.1/main.rb", "lib/jobs/MonitorMaster-0.0.1/main.rb", "lib/jobs/Node-0.0.1/main.rb", "lib/models/ThorModelClient.rb", "lib/models/ThorModelJob.rb", "lib/models/ThorModelWorker.rb", "bsl-thor.gemspec"]
|
14
|
+
s.homepage = "http://github.com/blacksnaillabs/thor"
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Bsl-thor", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = "bsl-thor"
|
18
|
+
s.rubygems_version = "1.8.12"
|
19
|
+
s.summary = "Thor distributed framework"
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
s.specification_version = 3
|
23
|
+
|
24
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
25
|
+
else
|
26
|
+
end
|
27
|
+
else
|
28
|
+
end
|
29
|
+
end
|
data/lib/BslThor.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'ThorApplication.rb')
|
2
|
+
require File.join(File.dirname(__FILE__), 'ThorClient.rb')
|
3
|
+
require File.join(File.dirname(__FILE__), 'ThorCmd.rb')
|
4
|
+
require File.join(File.dirname(__FILE__), 'ThorJob.rb')
|
5
|
+
require File.join(File.dirname(__FILE__), 'ThorMaster.rb')
|
6
|
+
require File.join(File.dirname(__FILE__), 'ThorNode.rb')
|
7
|
+
require File.join(File.dirname(__FILE__), 'ThorUtils.rb')
|
8
|
+
require File.join(File.dirname(__FILE__), 'ThorWorker.rb')
|
9
|
+
|
10
|
+
if $0 == __FILE__
|
11
|
+
Thor::require_all_models()
|
12
|
+
end
|
13
|
+
|
@@ -0,0 +1,139 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
require 'sys/admin'
|
4
|
+
require 'sys/proctable'
|
5
|
+
require 'sys/uname'
|
6
|
+
require 'sys/cpu'
|
7
|
+
require 'sys/uptime'
|
8
|
+
require 'net/proto'
|
9
|
+
require 'sys/host'
|
10
|
+
require 'sys/filesystem'
|
11
|
+
|
12
|
+
require 'Bsl'
|
13
|
+
|
14
|
+
require 'ThorUtils'
|
15
|
+
|
16
|
+
# Amqp Gems
|
17
|
+
require 'amqp'
|
18
|
+
|
19
|
+
# Event machine
|
20
|
+
require 'eventmachine'
|
21
|
+
|
22
|
+
module Thor
|
23
|
+
class Application < Bsl::Application
|
24
|
+
attr_accessor :request_exit
|
25
|
+
|
26
|
+
@@AMQP_DEFAULT_RETRY_INTERVAL = 3
|
27
|
+
@@AMQP_MAX_RETRY_INTERVAL = (30)
|
28
|
+
@@AMQP_MAX_RETRY_ATTEMPS = -1
|
29
|
+
@@AMQP_RETRY_MULTIPLER = 1.5
|
30
|
+
|
31
|
+
def initialize(opts = {})
|
32
|
+
super(opts)
|
33
|
+
|
34
|
+
# AMQP options
|
35
|
+
options[:amqp] = {}
|
36
|
+
options[:amqp][:host] = "localhost"
|
37
|
+
options[:amqp][:port] = 8467
|
38
|
+
options[:amqp][:user] = "guest"
|
39
|
+
options[:amqp][:password] = "guest"
|
40
|
+
options[:amqp][:vhost] = "/"
|
41
|
+
|
42
|
+
@amqp_retry_interval = @@AMQP_DEFAULT_RETRY_INTERVAL
|
43
|
+
@amqp_retry_attempt = 0
|
44
|
+
|
45
|
+
# Signalizes that application wants exit for some reason
|
46
|
+
@request_exit = false
|
47
|
+
|
48
|
+
initialize_optparser { |opts|
|
49
|
+
# AMQP Host
|
50
|
+
opts.on( '--amqp-host STRING', "AMQP Server hostname [default: #{options[:amqp][:host]}]") do |host|
|
51
|
+
options[:amqp][:host] = host
|
52
|
+
end
|
53
|
+
|
54
|
+
# AMQP Port
|
55
|
+
opts.on('--amqp-port NUM', "AMQP Server port number [default: #{options[:amqp][:port]}]") do |port|
|
56
|
+
options[:amqp][:port] = port
|
57
|
+
end
|
58
|
+
|
59
|
+
# AMQP Username
|
60
|
+
opts.on('--amqp-user STRING', "AMQP Username [default: #{options[:amqp][:user]}]") do |user|
|
61
|
+
options[:amqp][:user] = user
|
62
|
+
end
|
63
|
+
|
64
|
+
# AMQP Password
|
65
|
+
opts.on('--amqp-password STRING', "AMQP Password [default: #{options[:amqp][:password]}]") do |password|
|
66
|
+
options[:amqp][:password] = password
|
67
|
+
end
|
68
|
+
|
69
|
+
# AMQP Vhost
|
70
|
+
opts.on('--amqp-vhost STRING', "AMQP Virtual Host [default: #{options[:amqp][:vhost]}]") do |vhost|
|
71
|
+
options[:amqp][:vhost] = vhost
|
72
|
+
end
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def amqp_loop(amqp)
|
77
|
+
|
78
|
+
end
|
79
|
+
|
80
|
+
# Starts AMQP connection
|
81
|
+
def amqp_start
|
82
|
+
Bsl::Logger::Log "Starting AMQP - Connecting #{options[:amqp]['user']}@#{options[:amqp]['host']}:#{options[:amqp]['port']}#{options[:amqp]['vhost']}"
|
83
|
+
AMQP.start(:host => options[:amqp]['host'], :port => options[:amqp]['port'], :vhost => options[:amqp]['vhost'], :user => options[:amqp]['user'], :password => options[:amqp]['password'] ) do |amqp|
|
84
|
+
Bsl::Logger::Log "Connected to AMQP broker. Running #{AMQP::VERSION} version of the gem..."
|
85
|
+
|
86
|
+
amqp_loop(amqp)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
# Stops Running AMQP connection
|
91
|
+
def amqp_stop
|
92
|
+
Bsl::Logger::Log "Stopping AMQP"
|
93
|
+
AMQP.stop { EM.stop }
|
94
|
+
end
|
95
|
+
|
96
|
+
def amqp_handle_failure(e)
|
97
|
+
amqp_stop()
|
98
|
+
|
99
|
+
Bsl::Logger::Log "AMQP Failure, reason: '#{e.inspect}'."
|
100
|
+
|
101
|
+
if(@request_exit == true)
|
102
|
+
return false
|
103
|
+
end
|
104
|
+
|
105
|
+
max_attempts_reached = false
|
106
|
+
if(@@AMQP_MAX_RETRY_ATTEMPS != nil && @@AMQP_MAX_RETRY_ATTEMPS >= 0)
|
107
|
+
@amqp_retry_attempt = @amqp_retry_attempt + 1
|
108
|
+
max_attempts_reached = @amqp_retry_attempt > @@AMQP_MAX_RETRY_ATTEMPS
|
109
|
+
end
|
110
|
+
|
111
|
+
if(max_attempts_reached == false)
|
112
|
+
Bsl::Logger::Log "Next attempt in #{@amqp_retry_interval} sec(s)."
|
113
|
+
|
114
|
+
sleep (@amqp_retry_interval)
|
115
|
+
@amqp_retry_interval = @amqp_retry_interval * @@AMQP_RETRY_MULTIPLER
|
116
|
+
@amqp_retry_interval = @@AMQP_MAX_RETRY_INTERVAL if @amqp_retry_interval > @@AMQP_MAX_RETRY_INTERVAL
|
117
|
+
else
|
118
|
+
if(@@AMQP_MAX_RETRY_ATTEMPS != nil)
|
119
|
+
Bsl::Logger::Log "Maximum AQMP reconnect attempts limit reached (#{@@AMQP_MAX_RETRY_ATTEMPS}), quitting."
|
120
|
+
end
|
121
|
+
@request_exit = true
|
122
|
+
end
|
123
|
+
|
124
|
+
return true
|
125
|
+
end
|
126
|
+
|
127
|
+
def run(opts = {})
|
128
|
+
options = opts
|
129
|
+
end
|
130
|
+
|
131
|
+
def main
|
132
|
+
super()
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
if $0 == __FILE__
|
138
|
+
Thor::Application.new.main
|
139
|
+
end
|