rising_dragon 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -3
- data/lib/rising_dragon/error.rb +3 -0
- data/lib/rising_dragon/sqs/handler.rb +1 -0
- data/lib/rising_dragon/sqs/worker.rb +11 -3
- data/lib/rising_dragon/version.rb +1 -1
- data/lib/rising_dragon.rb +2 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 533a09e1547afe94b159b17a3358462a1b01f959
|
4
|
+
data.tar.gz: 7f90b319819e0f6a1f8854e1ce0c3ba11daef9f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb96a1582c43708a4b8f671af144e04c09b646ffa0dc22e7a87ba0eff00ea77080574bcee6a1c18f339d57bc8b51b462f80c1c298f564dfca1ce7d811a44c1fc
|
7
|
+
data.tar.gz: e5ba4bd2a1035b90775d4100d4ca88c2282c7901743d1b7553c309953d33d662587e4b955220ae92f3b4a1ce88443434b01143ed73c6778a3dde3d51279007c5
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Use AWS SQS/SNS as event worker for Microservices.
|
|
13
13
|
Add this line to your application's Gemfile:
|
14
14
|
|
15
15
|
```ruby
|
16
|
-
gem 'rising_dragon'
|
16
|
+
gem 'rising_dragon', '=> 0.2.0'
|
17
17
|
```
|
18
18
|
|
19
19
|
And then execute:
|
@@ -40,7 +40,6 @@ RisingDragon.sqs_client = Aws::SQS::Client.new(
|
|
40
40
|
access_key_id: Settings.aws.access_key_id,
|
41
41
|
region: Settings.aws.steps_sqs.region
|
42
42
|
)
|
43
|
-
RisingDragon.add_group("default_group", 25)
|
44
43
|
|
45
44
|
class StepsEventHandler < ::RisingDragon::SQS::Handler
|
46
45
|
def handle(event)
|
@@ -54,7 +53,7 @@ end
|
|
54
53
|
class SQSWorker
|
55
54
|
include RisingDragon::SQS::Worker
|
56
55
|
|
57
|
-
rising_dragon_options "SQSQueueName",
|
56
|
+
rising_dragon_options "SQSQueueName", "default_group"
|
58
57
|
|
59
58
|
rising_dragon_register "StepsEvent", StepsEventHandler
|
60
59
|
rising_dragon_ignore "IgnoreEvent"
|
@@ -9,11 +9,19 @@ module RisingDragon
|
|
9
9
|
end
|
10
10
|
|
11
11
|
module ClassMethods
|
12
|
-
def rising_dragon_options(sqs_queue_name,
|
13
|
-
shoryuken_opt = { queue: sqs_queue_name, body_parser: :json }.merge(opt)
|
12
|
+
def rising_dragon_options(sqs_queue_name, group_name, opt = {})
|
13
|
+
shoryuken_opt = { queue: sqs_queue_name, body_parser: :json, auto_delete: true }.merge(opt)
|
14
14
|
shoryuken_options(shoryuken_opt)
|
15
15
|
|
16
|
-
|
16
|
+
register_queue(sqs_queue_name, group_name, opt)
|
17
|
+
end
|
18
|
+
|
19
|
+
def register_queue(sqs_queue_name, group_name, option)
|
20
|
+
concurrency = option[:concurrency] || 25
|
21
|
+
Shoryuken.add_group(group_name, concurrency)
|
22
|
+
|
23
|
+
weight = option[:weight] || 1
|
24
|
+
Shoryuken.add_queue(sqs_queue_name, weight, group_name)
|
17
25
|
end
|
18
26
|
|
19
27
|
def rising_dragon_register(event_name, handle_class)
|
data/lib/rising_dragon.rb
CHANGED
@@ -2,11 +2,12 @@ require "shoryuken"
|
|
2
2
|
|
3
3
|
require "rising_dragon/version"
|
4
4
|
require "rising_dragon/event"
|
5
|
+
require "rising_dragon/error"
|
5
6
|
require "rising_dragon/sqs/emitter"
|
6
7
|
require "rising_dragon/sqs/handler"
|
7
8
|
require "rising_dragon/sqs/worker"
|
8
9
|
|
9
10
|
module RisingDragon
|
10
11
|
extend SingleForwardable
|
11
|
-
def_delegators(:Shoryuken, :
|
12
|
+
def_delegators(:Shoryuken, :sqs_client)
|
12
13
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rising_dragon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ota42y
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shoryuken
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- bin/console
|
143
143
|
- bin/setup
|
144
144
|
- lib/rising_dragon.rb
|
145
|
+
- lib/rising_dragon/error.rb
|
145
146
|
- lib/rising_dragon/event.rb
|
146
147
|
- lib/rising_dragon/sqs/emitter.rb
|
147
148
|
- lib/rising_dragon/sqs/handler.rb
|