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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e380dfda68728c3a827bace0ed7c693baceb3647
4
- data.tar.gz: b9a8b7c2c680f21fed1796f098798c58eb6cf79f
3
+ metadata.gz: 533a09e1547afe94b159b17a3358462a1b01f959
4
+ data.tar.gz: 7f90b319819e0f6a1f8854e1ce0c3ba11daef9f7
5
5
  SHA512:
6
- metadata.gz: b3604836e287b5669ebf1b3c5491d6a4c411d5ededc1b4f48d69284bd5478517e0ba2b51b3bc968747c235c8a9842f43a4027edaf785faeb92ad97a47c40d7d0
7
- data.tar.gz: 2b5561a269b8b76e8fc310589272c2eaadc339a0d255b60c9ca52357408c61a6e7bb704ada255d8d73baff685f43d911056d02bab643ef4c544ec13fd59b011e
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", 1, "default_group", auto_delete: true
56
+ rising_dragon_options "SQSQueueName", "default_group"
58
57
 
59
58
  rising_dragon_register "StepsEvent", StepsEventHandler
60
59
  rising_dragon_ignore "IgnoreEvent"
@@ -0,0 +1,3 @@
1
+ module RisingDragon
2
+ class UnOverwriteHandle < StandardError; end
3
+ end
@@ -3,6 +3,7 @@ module RisingDragon
3
3
  class Handler
4
4
  def handle(_event)
5
5
  # overwrite here :)
6
+ raise ::RisingDragon::UnOverwriteHandle
6
7
  end
7
8
  end
8
9
  end
@@ -9,11 +9,19 @@ module RisingDragon
9
9
  end
10
10
 
11
11
  module ClassMethods
12
- def rising_dragon_options(sqs_queue_name, weight, group, opt = {})
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
- Shoryuken.add_queue(sqs_queue_name, weight, group)
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)
@@ -1,3 +1,3 @@
1
1
  module RisingDragon
2
- VERSION = "0.1.1".freeze
2
+ VERSION = "0.2.0".freeze
3
3
  end
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, :add_group, :sqs_client)
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.1.1
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 00:00:00.000000000 Z
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