larva 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +1 -1
- data/{CHANGELOG → CHANGELOG.md} +7 -1
- data/larva.gemspec +3 -2
- data/lib/larva.rb +11 -3
- data/lib/larva/configuration.rb +12 -0
- data/lib/larva/daemon.rb +62 -0
- data/lib/larva/listener.rb +7 -7
- data/lib/larva/mocker.rb +21 -0
- data/lib/larva/version.rb +1 -1
- data/lib/larva/worker_pool.rb +6 -7
- data/test/configuration_test.rb +17 -0
- data/test/daemon_test.rb +74 -0
- data/test/larva_test.rb +3 -4
- data/test/listener_test.rb +7 -5
- data/test/mocker_test.rb +30 -0
- data/test/sample_config/meducation-sdk.yml +6 -0
- data/test/sample_config/propono.yml +13 -0
- data/test/test_helper.rb +14 -1
- data/test/worker_pool_test.rb +6 -7
- metadata +38 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12c15b7b7bc57f92c91c47d01c62920d97a0be27
|
4
|
+
data.tar.gz: 1b13eb4986a959ddc4a5d70fc9971dd9738505d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b713b7c5e6c851c28a25feaed71e7cfee6ab42e0f6fd1fbf0770f06689c139d0186d77ea735aea71a945655298443130bf8055b6d1d10bf752da06ff2d62e3d3
|
7
|
+
data.tar.gz: 441618eb8034aefe7ece3abaf25a2b3317b75649d01a4ad3884df6bf5daa2dcfeac6202482176a8a3af686216040a1d4f27943da6934d5d19c28b13cf99c757f
|
data/.travis.yml
CHANGED
data/{CHANGELOG → CHANGELOG.md}
RENAMED
@@ -1,5 +1,11 @@
|
|
1
|
+
# 0.5.0 / 2014-02-22
|
2
|
+
* [FEATURE] Rely on Propono config for queue suffix.
|
3
|
+
* [FEATURE] Add daemon support.
|
4
|
+
* [FEATURE] Add mocking support.
|
5
|
+
* [FEATURE] Add configuration to inherit from.
|
6
|
+
|
1
7
|
# 0.4.1 / 2014-02-22
|
2
|
-
* [FEATURE] Remove need for process method
|
8
|
+
* [FEATURE] Remove need for process method.
|
3
9
|
|
4
10
|
# 0.4.0 / 2014-02-22
|
5
11
|
* [FEATURE] Add meta-programming-based processors.
|
data/larva.gemspec
CHANGED
@@ -18,8 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "propono"
|
22
|
-
spec.add_dependency "filum"
|
21
|
+
spec.add_dependency "propono", "~> 1.0"
|
22
|
+
spec.add_dependency "filum", "~> 2.0"
|
23
|
+
spec.add_dependency "activesupport", "~> 3.2"
|
23
24
|
|
24
25
|
spec.add_development_dependency "bundler", "~> 1.3"
|
25
26
|
spec.add_development_dependency "rake"
|
data/lib/larva.rb
CHANGED
@@ -1,11 +1,19 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
require 'propono'
|
1
|
+
require 'active_support/core_ext'
|
4
2
|
require 'filum'
|
3
|
+
require 'propono'
|
5
4
|
|
5
|
+
require 'larva/configuration'
|
6
|
+
require 'larva/mocker'
|
6
7
|
require 'larva/listener'
|
7
8
|
require 'larva/processor'
|
8
9
|
require 'larva/worker_pool'
|
10
|
+
require 'larva/daemon'
|
9
11
|
|
10
12
|
module Larva
|
13
|
+
class LarvaError < StandardError
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.mock!
|
17
|
+
Mocker.mock!
|
18
|
+
end
|
11
19
|
end
|
data/lib/larva/daemon.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module Larva
|
2
|
+
class Daemon
|
3
|
+
def self.start(*args)
|
4
|
+
daemon = new(*args)
|
5
|
+
daemon.configure
|
6
|
+
daemon.start
|
7
|
+
daemon
|
8
|
+
end
|
9
|
+
|
10
|
+
# Allowed Options:
|
11
|
+
# :env - Defaults to development
|
12
|
+
# :meducation_sdk_secret_key - Defauls to looking in config file
|
13
|
+
def initialize(processors, options = {})
|
14
|
+
@processors = processors
|
15
|
+
@options = options
|
16
|
+
@config_dir = options.fetch(:config_dir) {raise LarvaError.new("Please provide :config_dir via options")}
|
17
|
+
@logfile = options.fetch(:logfile) {raise LarvaError.new("Please provide :logfile via options")}
|
18
|
+
@env = options[:env] || "development"
|
19
|
+
end
|
20
|
+
|
21
|
+
def start
|
22
|
+
Filum.logger.info "Starting Workerpool"
|
23
|
+
Larva::WorkerPool.start(@processors)
|
24
|
+
Filum.logger.info "Workerpool Finished"
|
25
|
+
end
|
26
|
+
|
27
|
+
def configure
|
28
|
+
Filum.setup(@logfile)
|
29
|
+
Filum.logger.info "Configuring Daemon"
|
30
|
+
|
31
|
+
if meducation_sdk_config = parse_config_file('meducation-sdk.yml')
|
32
|
+
MeducationSDK.config do |config|
|
33
|
+
config.access_id = meducation_sdk_config[:access_id]
|
34
|
+
config.secret_key = @options[:meducation_sdk_secret_key] || meducation_sdk_config[:secret_key]
|
35
|
+
config.logger = Filum.logger
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
if propono_config = parse_config_file('propono.yml')
|
40
|
+
Propono.config do |config|
|
41
|
+
config.use_iam_profile = propono_config[:use_iam_profile]
|
42
|
+
config.access_key = propono_config[:access_key]
|
43
|
+
config.secret_key = propono_config[:secret_key]
|
44
|
+
config.queue_region = propono_config[:region]
|
45
|
+
config.application_name = propono_config[:application_name]
|
46
|
+
config.queue_suffix = propono_config[:queue_suffix]
|
47
|
+
config.udp_host = "pergo.meducation.net"
|
48
|
+
config.udp_port = "9732"
|
49
|
+
config.logger = Filum.logger
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def parse_config_file(filename)
|
55
|
+
contents = File.read("#{@config_dir}/#{filename}")
|
56
|
+
hash = YAML::load(contents)
|
57
|
+
hash.stringify_keys[@env].symbolize_keys
|
58
|
+
rescue
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
data/lib/larva/listener.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
module Larva
|
2
2
|
class Listener
|
3
3
|
|
4
|
-
def self.listen(topic_name, processor
|
5
|
-
new(topic_name, processor
|
4
|
+
def self.listen(topic_name, processor)
|
5
|
+
new(topic_name, processor).listen
|
6
6
|
end
|
7
7
|
|
8
|
-
attr_reader :topic_name, :processor
|
9
|
-
def initialize(topic_name, processor
|
8
|
+
attr_reader :topic_name, :processor
|
9
|
+
def initialize(topic_name, processor)
|
10
10
|
@topic_name = topic_name
|
11
11
|
@processor = processor
|
12
|
-
@queue_suffix = queue_suffix
|
13
12
|
end
|
14
13
|
|
15
14
|
def listen
|
16
|
-
|
17
|
-
Propono.
|
15
|
+
queue_name = "#{topic_name}#{Propono.config.queue_suffix}"
|
16
|
+
Propono.config.logger.info "Starting to listen to queue #{queue_name}"
|
17
|
+
Propono.listen_to_queue("#{queue_name}") do |message, context|
|
18
18
|
Propono.config.logger.context_id = context[:id]
|
19
19
|
Propono.config.logger.info "Received message: #{message}"
|
20
20
|
processor.process(message)
|
data/lib/larva/mocker.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
module Larva
|
2
|
+
class Mocker
|
3
|
+
def self.mock!
|
4
|
+
Filum.setup('./log/test.log')
|
5
|
+
Propono::Publisher.any_instance.stubs(:publish_via_sns)
|
6
|
+
|
7
|
+
if const_defined?("MeducationSDK")
|
8
|
+
MeducationSDK.config do |config|
|
9
|
+
config.endpoint = "http://localhost:3000/system"
|
10
|
+
config.access_id = "Daemon"
|
11
|
+
config.secret_key = "foobar"
|
12
|
+
config.logger = Filum.logger
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
Propono.config do |config|
|
17
|
+
config.logger = Filum.logger
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
data/lib/larva/version.rb
CHANGED
data/lib/larva/worker_pool.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
module Larva
|
2
2
|
class WorkerPool
|
3
|
-
def self.start(processors
|
4
|
-
new(processors
|
3
|
+
def self.start(processors)
|
4
|
+
new(processors).start
|
5
5
|
end
|
6
6
|
|
7
|
-
attr_reader :processors, :
|
8
|
-
def initialize(processors
|
7
|
+
attr_reader :processors, :workers
|
8
|
+
def initialize(processors)
|
9
9
|
@processors = processors
|
10
|
-
@queue_suffix = queue_suffix
|
11
10
|
end
|
12
11
|
|
13
12
|
def start
|
@@ -25,13 +24,13 @@ module Larva
|
|
25
24
|
end
|
26
25
|
|
27
26
|
def start_worker(topic, processor)
|
28
|
-
Larva::Listener.listen(topic, processor
|
27
|
+
Larva::Listener.listen(topic, processor)
|
29
28
|
rescue => e
|
30
29
|
logger.error "Unexpected listener termination: #{e} #{e.backtrace}"
|
31
30
|
end
|
32
31
|
|
33
32
|
def keep_workers_alive
|
34
|
-
sleep(
|
33
|
+
sleep(5) while workers.all? { |t| t.alive? }
|
35
34
|
logger.error "Some threads have died"
|
36
35
|
end
|
37
36
|
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Larva
|
4
|
+
class ConfigurationTest < Minitest::Test
|
5
|
+
def test_configuration_sets_logger_correctly
|
6
|
+
assert_equal Filum.logger, Configuration.new.logger
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_configuration_sets_logger_correctly
|
10
|
+
logger = mock
|
11
|
+
config = Configuration.new
|
12
|
+
config.logger = logger
|
13
|
+
assert_equal logger, config.logger
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
data/test/daemon_test.rb
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Larva
|
4
|
+
class DaemonTest < Minitest::Test
|
5
|
+
def config_dir
|
6
|
+
File.expand_path('../sample_config', __FILE__)
|
7
|
+
end
|
8
|
+
|
9
|
+
def logfile
|
10
|
+
"log/test.log"
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_workerpool_is_started
|
14
|
+
processors = {foo: 'bar'}
|
15
|
+
Larva::WorkerPool.expects(:start).with(processors)
|
16
|
+
Daemon.start(processors, logfile: "./log/foo.log", config_dir: config_dir)
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_logfile_is_compulsary
|
20
|
+
assert_raises(LarvaError, "Please provide :logfile via options") do
|
21
|
+
Daemon.start({}, config_dir: config_dir)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_config_dir_is_compulsary
|
26
|
+
assert_raises(LarvaError, "Please provide :config_dir via options") do
|
27
|
+
Daemon.start({}, logfile: logfile)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_filum_gets_config
|
32
|
+
Daemon.start({}, logfile: logfile, config_dir: config_dir)
|
33
|
+
assert_equal logfile, Filum.logger.logfile
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_meducation_sdk_gets_config
|
37
|
+
Daemon.start({}, config_dir: config_dir, logfile: logfile)
|
38
|
+
assert_equal "Daemon", MeducationSDK.config.access_id
|
39
|
+
assert_equal "foobar", MeducationSDK.config.secret_key
|
40
|
+
assert_equal Filum.logger, MeducationSDK.config.logger
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_meducation_sdk_gets_config_with_env
|
44
|
+
Daemon.start({}, config_dir: config_dir, logfile: logfile, env: 'production')
|
45
|
+
assert_equal "Daemon", MeducationSDK.config.access_id
|
46
|
+
assert_equal nil, MeducationSDK.config.secret_key
|
47
|
+
assert_equal Filum.logger, MeducationSDK.config.logger
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_propono_gets_config
|
51
|
+
Daemon.start({}, config_dir: config_dir, logfile: logfile)
|
52
|
+
assert_equal "BADASSDEVKEY", Propono.config.access_key
|
53
|
+
assert_equal "SCARYDEVSECRET", Propono.config.secret_key
|
54
|
+
assert_equal "eu-west-1", Propono.config.queue_region
|
55
|
+
assert_equal "development_daemon", Propono.config.application_name
|
56
|
+
assert_equal "-dev", Propono.config.queue_suffix
|
57
|
+
assert_equal "pergo.meducation.net", Propono.config.udp_host
|
58
|
+
assert_equal "9732", Propono.config.udp_port
|
59
|
+
assert_equal Filum.logger, Propono.config.logger
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_propono_gets_config_with_env
|
63
|
+
Daemon.start({}, config_dir: config_dir, logfile: logfile, env: 'production')
|
64
|
+
assert_equal "BADASSPRODUCTIONKEY", Propono.config.access_key
|
65
|
+
assert_equal "SCARYPRODUCTIONSECRET", Propono.config.secret_key
|
66
|
+
assert_equal "eu-west-1", Propono.config.queue_region
|
67
|
+
assert_equal "daemon", Propono.config.application_name
|
68
|
+
assert_equal nil, Propono.config.queue_suffix
|
69
|
+
assert_equal "pergo.meducation.net", Propono.config.udp_host
|
70
|
+
assert_equal "9732", Propono.config.udp_port
|
71
|
+
assert_equal Filum.logger, Propono.config.logger
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
data/test/larva_test.rb
CHANGED
@@ -2,10 +2,9 @@ require File.expand_path('../test_helper', __FILE__)
|
|
2
2
|
|
3
3
|
module Larva
|
4
4
|
class LarvaTest < Minitest::Test
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
Propono.publish(topic, message)
|
5
|
+
def test_mock_proxies_to_mocker
|
6
|
+
Larva::Mocker.expects(:mock!)
|
7
|
+
Larva.mock!
|
9
8
|
end
|
10
9
|
end
|
11
10
|
end
|
data/test/listener_test.rb
CHANGED
@@ -5,25 +5,27 @@ module Larva
|
|
5
5
|
def test_listen_to_queue_is_called
|
6
6
|
topic_name = "Foo"
|
7
7
|
queue_suffix = "bar"
|
8
|
+
Propono.config.queue_suffix = queue_suffix
|
8
9
|
Propono.expects(:listen_to_queue).with("#{topic_name}#{queue_suffix}")
|
9
|
-
Larva::Listener.listen(topic_name, nil
|
10
|
+
Larva::Listener.listen(topic_name, nil)
|
10
11
|
end
|
11
12
|
|
12
13
|
def test_listener_logs_listening_message
|
13
14
|
topic_name = "Foo"
|
14
15
|
queue_suffix = "bar"
|
16
|
+
Propono.config.queue_suffix = queue_suffix
|
15
17
|
|
16
18
|
message = "Starting to listen to queue #{topic_name}#{queue_suffix}"
|
17
19
|
Propono.config.logger.expects(:info).with(message)
|
18
20
|
Propono.stubs(:listen_to_queue)
|
19
|
-
Larva::Listener.listen(topic_name, nil
|
21
|
+
Larva::Listener.listen(topic_name, nil)
|
20
22
|
end
|
21
23
|
|
22
24
|
def test_listener_changes_context
|
23
25
|
context = {id: "34sdf"}
|
24
26
|
Propono.config.logger.expects(:context_id=).with(context[:id])
|
25
27
|
Propono.stubs(:listen_to_queue).yields(nil, context)
|
26
|
-
Larva::Listener.listen("foobar", mock(process: nil)
|
28
|
+
Larva::Listener.listen("foobar", mock(process: nil))
|
27
29
|
end
|
28
30
|
|
29
31
|
def test_listener_logs_message
|
@@ -32,7 +34,7 @@ module Larva
|
|
32
34
|
Propono.config.logger.stubs(:info)
|
33
35
|
Propono.config.logger.expects(:info).with("Received message: #{message}")
|
34
36
|
Propono.stubs(:listen_to_queue).yields(message, context)
|
35
|
-
Larva::Listener.listen("foobar", mock(process: nil)
|
37
|
+
Larva::Listener.listen("foobar", mock(process: nil))
|
36
38
|
end
|
37
39
|
|
38
40
|
def test_processor_is_called_with_message
|
@@ -40,7 +42,7 @@ module Larva
|
|
40
42
|
message = {foo: 'bar'}
|
41
43
|
processor.expects(:process).with(message)
|
42
44
|
Propono.expects(:listen_to_queue).yields(message, {})
|
43
|
-
Larva::Listener.listen("foobar", processor
|
45
|
+
Larva::Listener.listen("foobar", processor)
|
44
46
|
end
|
45
47
|
end
|
46
48
|
end
|
data/test/mocker_test.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require File.expand_path('../test_helper', __FILE__)
|
2
|
+
|
3
|
+
module Larva
|
4
|
+
class MockerTest < Minitest::Test
|
5
|
+
def test_filum_is_setup
|
6
|
+
Filum.expects(:setup).with('./log/test.log')
|
7
|
+
Mocker.mock!
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_propono_publisher_is_stubbed
|
11
|
+
any_instance = mock()
|
12
|
+
any_instance.expects(:stubs).with(:publish_via_sns)
|
13
|
+
Propono::Publisher.expects(:any_instance).returns(any_instance)
|
14
|
+
Mocker.mock!
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_loquor_is_setup
|
18
|
+
Mocker.mock!
|
19
|
+
assert_equal "http://localhost:3000/system", MeducationSDK.config.endpoint
|
20
|
+
assert_equal "Daemon", MeducationSDK.config.access_id
|
21
|
+
assert_equal "foobar", MeducationSDK.config.secret_key
|
22
|
+
assert_equal Filum.logger, MeducationSDK.config.logger
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_propono_is_configured
|
26
|
+
Mocker.mock!
|
27
|
+
assert_equal Filum.logger, Propono.config.logger
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
development:
|
2
|
+
access_key: BADASSDEVKEY
|
3
|
+
secret_key: SCARYDEVSECRET
|
4
|
+
region: eu-west-1
|
5
|
+
application_name: development_daemon
|
6
|
+
queue_suffix: -dev
|
7
|
+
|
8
|
+
production:
|
9
|
+
access_key: BADASSPRODUCTIONKEY
|
10
|
+
secret_key: SCARYPRODUCTIONSECRET
|
11
|
+
region: eu-west-1
|
12
|
+
application_name: daemon
|
13
|
+
queue_suffix:
|
data/test/test_helper.rb
CHANGED
@@ -9,15 +9,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
9
9
|
|
10
10
|
require "larva"
|
11
11
|
|
12
|
+
module MeducationSDK
|
13
|
+
def self.config
|
14
|
+
@config ||= Struct.new(:access_id, :secret_key, :endpoint, :logger).new
|
15
|
+
if block_given?
|
16
|
+
yield @config
|
17
|
+
else
|
18
|
+
@config
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
12
23
|
class Minitest::Test
|
24
|
+
|
13
25
|
def setup
|
14
26
|
Fog.mock!
|
15
|
-
Filum.
|
27
|
+
Filum.setup('log/test.log')
|
16
28
|
Propono.config do |config|
|
17
29
|
config.access_key = "test-access-key"
|
18
30
|
config.secret_key = "test-secret-key"
|
19
31
|
config.queue_region = "us-east-1"
|
20
32
|
config.application_name = "MyApp"
|
33
|
+
config.queue_suffix = nil
|
21
34
|
|
22
35
|
config.logger = Filum.logger
|
23
36
|
end
|
data/test/worker_pool_test.rb
CHANGED
@@ -3,19 +3,19 @@ require File.expand_path('../test_helper', __FILE__)
|
|
3
3
|
module Larva
|
4
4
|
class WorkerPoolTest < Minitest::Test
|
5
5
|
def test_should_complete_for_no_processors
|
6
|
-
WorkerPool.start({}
|
6
|
+
WorkerPool.start({})
|
7
7
|
end
|
8
8
|
|
9
9
|
def test_process_logs_start_message
|
10
10
|
Propono.config.logger.stubs(:info)
|
11
11
|
Propono.config.logger.expects(:info).with("Starting threads.")
|
12
|
-
WorkerPool.start({}
|
12
|
+
WorkerPool.start({})
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_process_logs_end_message
|
16
16
|
Propono.config.logger.stubs(:info)
|
17
17
|
Propono.config.logger.expects(:info).with("Threads Started.")
|
18
|
-
WorkerPool.start({}
|
18
|
+
WorkerPool.start({})
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_start_worker_logs_exception
|
@@ -24,15 +24,14 @@ module Larva
|
|
24
24
|
error.start_with?("Unexpected listener termination:")
|
25
25
|
end
|
26
26
|
Propono.config.logger.expects(:error).with('Some threads have died')
|
27
|
-
WorkerPool.start({nil => nil}
|
27
|
+
WorkerPool.start({nil => nil})
|
28
28
|
end
|
29
29
|
|
30
30
|
def test_listen_is_called_correctly
|
31
31
|
topic_name = "Foo"
|
32
32
|
processor = mock
|
33
|
-
|
34
|
-
|
35
|
-
WorkerPool.start({topic_name => processor}, queue_suffix)
|
33
|
+
Larva::Listener.expects(:listen).with(topic_name, processor)
|
34
|
+
WorkerPool.start({topic_name => processor})
|
36
35
|
end
|
37
36
|
end
|
38
37
|
end
|
metadata
CHANGED
@@ -1,43 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: larva
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iHiD
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: propono
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
19
|
+
version: '1.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
26
|
+
version: '1.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: filum
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: activesupport
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.2'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.2'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -103,7 +117,7 @@ extra_rdoc_files: []
|
|
103
117
|
files:
|
104
118
|
- .gitignore
|
105
119
|
- .travis.yml
|
106
|
-
- CHANGELOG
|
120
|
+
- CHANGELOG.md
|
107
121
|
- CONTRIBUTING.md
|
108
122
|
- Gemfile
|
109
123
|
- LICENCE.md
|
@@ -111,13 +125,21 @@ files:
|
|
111
125
|
- README.md
|
112
126
|
- larva.gemspec
|
113
127
|
- lib/larva.rb
|
128
|
+
- lib/larva/configuration.rb
|
129
|
+
- lib/larva/daemon.rb
|
114
130
|
- lib/larva/listener.rb
|
131
|
+
- lib/larva/mocker.rb
|
115
132
|
- lib/larva/processor.rb
|
116
133
|
- lib/larva/version.rb
|
117
134
|
- lib/larva/worker_pool.rb
|
135
|
+
- test/configuration_test.rb
|
136
|
+
- test/daemon_test.rb
|
118
137
|
- test/larva_test.rb
|
119
138
|
- test/listener_test.rb
|
139
|
+
- test/mocker_test.rb
|
120
140
|
- test/processor_test.rb
|
141
|
+
- test/sample_config/meducation-sdk.yml
|
142
|
+
- test/sample_config/propono.yml
|
121
143
|
- test/test_helper.rb
|
122
144
|
- test/worker_pool_test.rb
|
123
145
|
homepage: https://github.com/meducation/larva
|
@@ -145,9 +167,14 @@ signing_key:
|
|
145
167
|
specification_version: 4
|
146
168
|
summary: Some Meducation specific helper files for ur pub/sub network
|
147
169
|
test_files:
|
170
|
+
- test/configuration_test.rb
|
171
|
+
- test/daemon_test.rb
|
148
172
|
- test/larva_test.rb
|
149
173
|
- test/listener_test.rb
|
174
|
+
- test/mocker_test.rb
|
150
175
|
- test/processor_test.rb
|
176
|
+
- test/sample_config/meducation-sdk.yml
|
177
|
+
- test/sample_config/propono.yml
|
151
178
|
- test/test_helper.rb
|
152
179
|
- test/worker_pool_test.rb
|
153
180
|
has_rdoc:
|