action_subscriber 3.0.0.pre2 → 3.0.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: f453f7e59eee1009c949b5e395359dc59b637c5f
4
- data.tar.gz: 426ef40b324f3770306f790b3f03673905670a23
3
+ metadata.gz: 52c0f3db37ebe4b428841306b9adba37f2f39a58
4
+ data.tar.gz: c02900ab22466a4cd485a39530379cd215aae0e5
5
5
  SHA512:
6
- metadata.gz: b644cb531eacde80a9f7878fcfeb3c50925b70dc5bafdf3d753462a505883645e7bf81220e727aac99b399a82e9951df276676e9a12d20e903a22dd72132df65
7
- data.tar.gz: 410c264a22022b14a2fe4a7a44674c184b982dcd9562b5e2966def02b12043ee3fe6f27387b139820f32e5cdd1e53edcc3d4af42b954d3e8a139c9ce5cad6af2
6
+ metadata.gz: 3859b7e0dded455b94130370401011037f7a9d1cfad814aedca554134bc33a0272fa9c87d3a070c5a6336e81451aaddf5a8c8a2046bf8784c9335980b047da37
7
+ data.tar.gz: d39b119f253a6bbee3f3150d0936e8f5ddacb71f02df0641304c084ca1d8a1b6e3d3ae0d3bc2f69f370e8793199f8305adfd7295f46645d3ebaecb39427e26ec
data/README.md CHANGED
@@ -24,8 +24,6 @@ A subscriber is set up by creating a class that inherits from ActionSubscriber::
24
24
 
25
25
  ```ruby
26
26
  class UserSubscriber < ::ActionSubscriber::Base
27
- publisher :user_hq
28
-
29
27
  def created
30
28
  # do something when a user is created
31
29
  end
@@ -36,35 +34,29 @@ checkout the examples dir for more detailed examples.
36
34
 
37
35
  Usage
38
36
  -----------------
39
- ActionSubscriber is inspired by rails observers, and if you are familiar with rails
40
- observers the ActionSubscriber DSL should make you feel right at home!
41
-
42
- First, create a subscriber the inherits from ActionSubscriber::Base
43
37
 
44
- Then, when your app starts up, you will need to load your subscriber code and then do
38
+ In your application setup you will draw your subscription routes. In a rails app this is usually done in `config/initializers/action_subscriber.rb`.
45
39
 
46
40
  ```ruby
47
- ActionSubscriber.start_subscribers
48
- while true
49
- sleep 1.0
41
+ ::ActionSubscriber.draw_routes do
42
+ # you can define routes one-by-one for fine-grained controled
43
+ route UserSubscriber, :created
44
+
45
+ # or you can setup default routes for all the public methods in a subscriber
46
+ default_routes_for UserSubscriber
50
47
  end
51
48
  ```
52
49
 
53
- or
50
+ Now you can start your subscriber process with:
54
51
 
55
- ```ruby
56
- ::ActionSubscriber.start_queues
57
- while true
58
- ::ActionSubscriber.auto_pop!
59
- sleep 1.0
60
- end
52
+
53
+ ```
54
+ $ bundle exec action_subscriber start --mode=subscribe
61
55
  ```
62
56
 
63
- Any public methods on your subscriber will be registered as queues with rabbit with
64
- routing keys named intelligently.
57
+ This will start your subscribers in a mode where they connect to rabbitmq and let the broker push messages down to them.
65
58
 
66
- Once ActionSubscriber receives a message, it will call the associated method and the
67
- parameter you recieve will be a decoded message.
59
+ You can also start in `--mode=pop` where your process will poll the broker for messages.
68
60
 
69
61
  Configuration
70
62
  -----------------
@@ -80,11 +72,11 @@ In an initializer, you can set the host and the port like this :
80
72
  Other configuration options include :
81
73
 
82
74
  * config.add_decoder - add a custom decoder for a custom content type
83
- * config.allow_low_priority_methods - subscribe to queues for methods suffixed with "_low"
84
75
  * config.default_exchange - set the default exchange that your queues will use, using the default RabbitMQ exchange is not recommended
85
76
  * config.error_handler - handle error like you want to handle them!
86
77
  * config.heartbeat - number of seconds between hearbeats (default 5) [see bunny documentation for more details](http://rubybunny.info/articles/connecting.html)
87
- * config.hosts - an array of hostnames in your cluster
78
+ * config.hosts - an array of hostnames in your cluster (ie `["rabbit1.myapp.com", "rabbit2.myapp.com"]`)
79
+ * config.pop_interval - how long to wait between polling for messages in `--mode=pop`. It should be a number of milliseconds
88
80
  * config.threadpool_size - set the number of threads availiable to action_subscriber
89
81
  * config.timeout - how many seconds to allow rabbit to respond before timing out
90
82
  * config.times_to_pop - when using RabbitMQ's pull API, the number of messages we will grab each time we pool the broker
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "3.0.0.pre2"
2
+ VERSION = "3.0.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_subscriber
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre2
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Stien
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2016-09-20 00:00:00.000000000 Z
15
+ date: 2016-09-22 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -280,9 +280,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
280
280
  version: '0'
281
281
  required_rubygems_version: !ruby/object:Gem::Requirement
282
282
  requirements:
283
- - - ">"
283
+ - - ">="
284
284
  - !ruby/object:Gem::Version
285
- version: 1.3.1
285
+ version: '0'
286
286
  requirements: []
287
287
  rubyforge_project:
288
288
  rubygems_version: 2.6.6