euston-daemons 1.0.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +4 -0
- data/Gemfile.lock +101 -0
- data/LICENSE +19 -0
- data/Rakefile +161 -0
- data/euston-daemons.gemspec +69 -0
- data/lib/euston-daemons.rb +15 -0
- data/lib/euston-daemons/command_processor_daemon/config/environment.rb +14 -0
- data/lib/euston-daemons/command_processor_daemon/lib/components/command_handler_component.rb +55 -0
- data/lib/euston-daemons/command_processor_daemon/lib/daemon.rb +43 -0
- data/lib/euston-daemons/command_processor_daemon/lib/settings.rb +19 -0
- data/lib/euston-daemons/command_processor_daemon/rake_task.rb +31 -0
- data/lib/euston-daemons/event_processor_daemon/config/environment.rb +20 -0
- data/lib/euston-daemons/event_processor_daemon/lib/components/event_handler_component.rb +72 -0
- data/lib/euston-daemons/event_processor_daemon/lib/daemon.rb +72 -0
- data/lib/euston-daemons/event_processor_daemon/lib/settings.rb +22 -0
- data/lib/euston-daemons/event_processor_daemon/rake_task.rb +37 -0
- data/lib/euston-daemons/framework/basic_component.rb +33 -0
- data/lib/euston-daemons/framework/component_shutdown.rb +22 -0
- data/lib/euston-daemons/framework/daemon.rb +27 -0
- data/lib/euston-daemons/framework/queue.rb +71 -0
- data/lib/euston-daemons/message_buffer_daemon/config/environment.rb +26 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/components/buffer_component.rb +74 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/components/event_store_component.rb +51 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/daemon.rb +48 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/message_logger.rb +54 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/publisher.rb +56 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/read_model/message_buffer.rb +54 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/read_model/message_log.rb +36 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/settings.rb +14 -0
- data/lib/euston-daemons/message_buffer_daemon/lib/subscriber.rb +60 -0
- data/lib/euston-daemons/message_buffer_daemon/rake_task.rb +30 -0
- data/lib/euston-daemons/rake_task.rb +116 -0
- data/lib/euston-daemons/version.rb +5 -0
- metadata +235 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
module Euston
|
2
|
+
class MessageBufferRakeTask < Euston::Daemons::RakeTask
|
3
|
+
attr_accessor :amqp_config_path, :daemon_config_path, :mongoid_config_path
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
super(:message_buffer_daemon)
|
7
|
+
end
|
8
|
+
|
9
|
+
def before_creating_task
|
10
|
+
@daemon_path = File.expand_path(File.dirname __FILE__) + File::SEPARATOR
|
11
|
+
@daemon_class = 'Euston::MessageBufferDaemon::Daemon'
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize_paths
|
15
|
+
EUSTON_LOG.debug "AMQP config path: #{@amqp_config_path}"
|
16
|
+
Object.const_set :AMQP_CONFIG_PATH, @amqp_config_path
|
17
|
+
|
18
|
+
EUSTON_LOG.debug "Daemon config path: #{@daemon_config_path}"
|
19
|
+
Object.const_set :DAEMON_CONFIG_PATH, @daemon_config_path
|
20
|
+
|
21
|
+
EUSTON_LOG.debug "Mongoid config path: #{@mongoid_config_path}"
|
22
|
+
Object.const_set :MONGOID_CONFIG_PATH, @mongoid_config_path
|
23
|
+
end
|
24
|
+
|
25
|
+
def load_environment
|
26
|
+
EUSTON_LOG.debug "Loading environment"
|
27
|
+
require_rel 'config/environment.rb'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Euston
|
2
|
+
module Daemons
|
3
|
+
class RakeTask < ::Rake::TaskLib
|
4
|
+
include ::Rake::DSL if defined?(::Rake::DSL)
|
5
|
+
|
6
|
+
# Name of task.
|
7
|
+
#
|
8
|
+
# default:
|
9
|
+
# :daemon
|
10
|
+
attr_accessor :name
|
11
|
+
|
12
|
+
# Bundler groups. Can be a single symbol or an array of symbols.
|
13
|
+
attr_accessor :bundler_groups
|
14
|
+
|
15
|
+
# Daemon class. Must be supplied as a string.
|
16
|
+
attr_accessor :daemon_class
|
17
|
+
|
18
|
+
# Log file path
|
19
|
+
#
|
20
|
+
# default:
|
21
|
+
# /var/log/euston.log
|
22
|
+
attr_accessor :log_path
|
23
|
+
|
24
|
+
# Use verbose output. If this is set to true, the task will print the
|
25
|
+
# executed command to stdout.
|
26
|
+
#
|
27
|
+
# default:
|
28
|
+
# true
|
29
|
+
attr_accessor :verbose
|
30
|
+
|
31
|
+
def initialize(*args)
|
32
|
+
@name = args.shift || :daemon
|
33
|
+
@log_path = '/var/log/euston.log'
|
34
|
+
@verbose = true
|
35
|
+
|
36
|
+
Object.const_set :EUSTON_ENV, get_environment unless Object.const_defined? :EUSTON_ENV
|
37
|
+
|
38
|
+
yield self if block_given?
|
39
|
+
send :before_creating_task if respond_to? :before_creating_task
|
40
|
+
|
41
|
+
desc("Run a Euston daemon") unless ::Rake.application.last_comment
|
42
|
+
|
43
|
+
task name do
|
44
|
+
RakeFileUtils.send(:verbose, verbose) do
|
45
|
+
initialize_logger
|
46
|
+
log_startup
|
47
|
+
initialize_paths
|
48
|
+
load_framework
|
49
|
+
load_environment
|
50
|
+
launch_and_wait_for_exit
|
51
|
+
log_shutdown
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
private
|
57
|
+
|
58
|
+
def get_environment
|
59
|
+
environment = ENV['EUSTON_ENV'].to_s.downcase.to_sym
|
60
|
+
environments = [:development, :test, :staging, :production]
|
61
|
+
environment = :development unless environments.include? environment
|
62
|
+
environment
|
63
|
+
end
|
64
|
+
|
65
|
+
def initialize_logger
|
66
|
+
Object.const_set :EUSTON_LOG, Logger.new(@log_path.gsub(/\.log$/, ".#{EUSTON_ENV}.log"))
|
67
|
+
end
|
68
|
+
|
69
|
+
def initialize_paths
|
70
|
+
# virtual
|
71
|
+
end
|
72
|
+
|
73
|
+
def launch_and_wait_for_exit
|
74
|
+
ns = Object
|
75
|
+
|
76
|
+
@daemon_class.split('::').each do |c|
|
77
|
+
raise "Couldn't find the specified daemon class at #{@daemon_class}" unless ns.const_defined? c
|
78
|
+
ns = ns.const_get c.to_sym
|
79
|
+
end
|
80
|
+
|
81
|
+
daemon = ns.new
|
82
|
+
trap_exit_signals daemon
|
83
|
+
daemon.run
|
84
|
+
end
|
85
|
+
|
86
|
+
def load_framework
|
87
|
+
EUSTON_LOG.debug "Loading framework"
|
88
|
+
require_rel 'framework'
|
89
|
+
end
|
90
|
+
|
91
|
+
def log_shutdown
|
92
|
+
print_log_banner "Daemon shut down: #{@daemon_class}"
|
93
|
+
end
|
94
|
+
|
95
|
+
def log_startup
|
96
|
+
print_log_banner "Starting daemon: #{@daemon_class}"
|
97
|
+
end
|
98
|
+
|
99
|
+
def print_log_banner banner
|
100
|
+
border = '-' * banner.length
|
101
|
+
|
102
|
+
EUSTON_LOG.info ''
|
103
|
+
EUSTON_LOG.info border
|
104
|
+
EUSTON_LOG.info banner
|
105
|
+
EUSTON_LOG.info border
|
106
|
+
EUSTON_LOG.info ''
|
107
|
+
end
|
108
|
+
|
109
|
+
def trap_exit_signals daemon
|
110
|
+
signals = %W(INT TERM) & Signal.list.keys
|
111
|
+
signals.each { |sig| sig.freeze }.freeze
|
112
|
+
signals.each { |sig| Signal.trap(sig) { daemon.queue.push(sig) } }
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: euston-daemons
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
|
+
platform: java
|
7
|
+
authors:
|
8
|
+
- Lee Henson
|
9
|
+
- Guy Boertje
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2011-09-16 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: activemodel
|
17
|
+
version_requirements: &2058 !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.0.0
|
22
|
+
none: false
|
23
|
+
requirement: *2058
|
24
|
+
prerelease: false
|
25
|
+
type: :runtime
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: activesupport
|
28
|
+
version_requirements: &2076 !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.0.0
|
33
|
+
none: false
|
34
|
+
requirement: *2076
|
35
|
+
prerelease: false
|
36
|
+
type: :runtime
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: erb-yaml
|
39
|
+
version_requirements: &2092 !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.0
|
44
|
+
none: false
|
45
|
+
requirement: *2092
|
46
|
+
prerelease: false
|
47
|
+
type: :runtime
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: hollywood
|
50
|
+
version_requirements: &2108 !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
none: false
|
56
|
+
requirement: *2108
|
57
|
+
prerelease: false
|
58
|
+
type: :runtime
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: i18n
|
61
|
+
version_requirements: &2124 !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.5.0
|
66
|
+
none: false
|
67
|
+
requirement: *2124
|
68
|
+
prerelease: false
|
69
|
+
type: :runtime
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: require_all
|
72
|
+
version_requirements: &2140 !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ~>
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.2.0
|
77
|
+
none: false
|
78
|
+
requirement: *2140
|
79
|
+
prerelease: false
|
80
|
+
type: :runtime
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: safely
|
83
|
+
version_requirements: &2156 !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - ~>
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 0.3.0
|
88
|
+
none: false
|
89
|
+
requirement: *2156
|
90
|
+
prerelease: false
|
91
|
+
type: :runtime
|
92
|
+
- !ruby/object:Gem::Dependency
|
93
|
+
name: euston
|
94
|
+
version_requirements: &2172 !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ~>
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 1.0.0
|
99
|
+
none: false
|
100
|
+
requirement: *2172
|
101
|
+
prerelease: false
|
102
|
+
type: :runtime
|
103
|
+
- !ruby/object:Gem::Dependency
|
104
|
+
name: euston-eventstore
|
105
|
+
version_requirements: &2188 !ruby/object:Gem::Requirement
|
106
|
+
requirements:
|
107
|
+
- - ~>
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: 1.0.0
|
110
|
+
none: false
|
111
|
+
requirement: *2188
|
112
|
+
prerelease: false
|
113
|
+
type: :runtime
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: euston-rabbitmq
|
116
|
+
version_requirements: &2204 !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ~>
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: 1.0.0
|
121
|
+
none: false
|
122
|
+
requirement: *2204
|
123
|
+
prerelease: false
|
124
|
+
type: :runtime
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: jessica
|
127
|
+
version_requirements: &2220 !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ~>
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.0
|
132
|
+
none: false
|
133
|
+
requirement: *2220
|
134
|
+
prerelease: false
|
135
|
+
type: :runtime
|
136
|
+
- !ruby/object:Gem::Dependency
|
137
|
+
name: jmongo
|
138
|
+
version_requirements: &2236 !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ~>
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: 1.0.0
|
143
|
+
none: false
|
144
|
+
requirement: *2236
|
145
|
+
prerelease: false
|
146
|
+
type: :runtime
|
147
|
+
- !ruby/object:Gem::Dependency
|
148
|
+
name: mongoid-glue
|
149
|
+
version_requirements: &2252 !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ~>
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 1.0.0
|
154
|
+
none: false
|
155
|
+
requirement: *2252
|
156
|
+
prerelease: false
|
157
|
+
type: :runtime
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: rspec
|
160
|
+
version_requirements: &2268 !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ~>
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 2.6.0
|
165
|
+
none: false
|
166
|
+
requirement: *2268
|
167
|
+
prerelease: false
|
168
|
+
type: :development
|
169
|
+
description: ''
|
170
|
+
email:
|
171
|
+
- lee.m.henson@gmail.com
|
172
|
+
- guyboertje@gmail.com
|
173
|
+
executables: []
|
174
|
+
extensions: []
|
175
|
+
extra_rdoc_files: []
|
176
|
+
files:
|
177
|
+
- Gemfile
|
178
|
+
- Gemfile.lock
|
179
|
+
- LICENSE
|
180
|
+
- Rakefile
|
181
|
+
- euston-daemons.gemspec
|
182
|
+
- lib/euston-daemons.rb
|
183
|
+
- lib/euston-daemons/command_processor_daemon/config/environment.rb
|
184
|
+
- lib/euston-daemons/command_processor_daemon/lib/components/command_handler_component.rb
|
185
|
+
- lib/euston-daemons/command_processor_daemon/lib/daemon.rb
|
186
|
+
- lib/euston-daemons/command_processor_daemon/lib/settings.rb
|
187
|
+
- lib/euston-daemons/command_processor_daemon/rake_task.rb
|
188
|
+
- lib/euston-daemons/event_processor_daemon/config/environment.rb
|
189
|
+
- lib/euston-daemons/event_processor_daemon/lib/components/event_handler_component.rb
|
190
|
+
- lib/euston-daemons/event_processor_daemon/lib/daemon.rb
|
191
|
+
- lib/euston-daemons/event_processor_daemon/lib/settings.rb
|
192
|
+
- lib/euston-daemons/event_processor_daemon/rake_task.rb
|
193
|
+
- lib/euston-daemons/framework/basic_component.rb
|
194
|
+
- lib/euston-daemons/framework/component_shutdown.rb
|
195
|
+
- lib/euston-daemons/framework/daemon.rb
|
196
|
+
- lib/euston-daemons/framework/queue.rb
|
197
|
+
- lib/euston-daemons/message_buffer_daemon/config/environment.rb
|
198
|
+
- lib/euston-daemons/message_buffer_daemon/lib/components/buffer_component.rb
|
199
|
+
- lib/euston-daemons/message_buffer_daemon/lib/components/event_store_component.rb
|
200
|
+
- lib/euston-daemons/message_buffer_daemon/lib/daemon.rb
|
201
|
+
- lib/euston-daemons/message_buffer_daemon/lib/message_logger.rb
|
202
|
+
- lib/euston-daemons/message_buffer_daemon/lib/publisher.rb
|
203
|
+
- lib/euston-daemons/message_buffer_daemon/lib/read_model/message_buffer.rb
|
204
|
+
- lib/euston-daemons/message_buffer_daemon/lib/read_model/message_log.rb
|
205
|
+
- lib/euston-daemons/message_buffer_daemon/lib/settings.rb
|
206
|
+
- lib/euston-daemons/message_buffer_daemon/lib/subscriber.rb
|
207
|
+
- lib/euston-daemons/message_buffer_daemon/rake_task.rb
|
208
|
+
- lib/euston-daemons/rake_task.rb
|
209
|
+
- lib/euston-daemons/version.rb
|
210
|
+
homepage: http://github.com/leemhenson/euston-daemons
|
211
|
+
licenses: []
|
212
|
+
post_install_message:
|
213
|
+
rdoc_options: []
|
214
|
+
require_paths:
|
215
|
+
- lib
|
216
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ! '>='
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
none: false
|
222
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ! '>='
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
none: false
|
228
|
+
requirements: []
|
229
|
+
rubyforge_project:
|
230
|
+
rubygems_version: 1.8.9
|
231
|
+
signing_key:
|
232
|
+
specification_version: 3
|
233
|
+
summary: Message buffer, command processor and event processor daemons for Euston-RabbitMq
|
234
|
+
test_files: []
|
235
|
+
...
|