action_subscriber 3.0.0.pre2-java → 3.0.1-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65fce1739063a1cf33dba2d29452a76add18ea96
4
- data.tar.gz: 75d402b7e378ae9cf3d1eae35e694ffc23f4373c
3
+ metadata.gz: 1399aac04de823cbbdd75e1dba0f8ae3c45232ed
4
+ data.tar.gz: 404f24d6a475c20942452178d77c6bfca7aad2a9
5
5
  SHA512:
6
- metadata.gz: 7a7fa9c4143d3eef353301118acda43ca49b9c6bc7a07a846bc75e100aa6eefb926e31b8934b146dddb49bac572b9a2c74c3dcb860cc1cb23ddaa6c5fadd7ec6
7
- data.tar.gz: 5861f99195162aec8d18c4d436f65f0ffda7a3e9438175218568770eaf17f54a00f1202fef76d661661a237b4375d5055e8fcb24634c509b2189e0e58a867951
6
+ metadata.gz: 26ae9eedc5301772ed162f6db18e461c8e4a982a4ceb1bd2e59a8558f92de203a61445eeea2c78ef5601131351a2dd3a9efba5cb42fee4ad087d1620e1979393
7
+ data.tar.gz: ed762a8e65760130503ce53a5914f4e97e3a2613bcf59be3b09f0b65dae3cdfd64a14aaf39dbc2038f23396d329d13d73926ffac721206e6b516ead2e7be33b3
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
@@ -36,6 +36,9 @@ module ActionSubscriber
36
36
  def self.create_connection(settings)
37
37
  options = connection_options.merge(settings)
38
38
  if ::RUBY_PLATFORM == "java"
39
+ options[:executor_factory] = ::Proc.new do
40
+ ::MarchHare::ThreadPools.fixed_of_size(options[:threadpool_size])
41
+ end
39
42
  connection = ::MarchHare.connect(options)
40
43
  else
41
44
  connection = ::Bunny.new(options)
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "3.0.0.pre2"
2
+ VERSION = "3.0.1"
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.1
5
5
  platform: java
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-23 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  requirement: !ruby/object:Gem::Requirement
@@ -279,9 +279,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
279
279
  version: '0'
280
280
  required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  requirements:
282
- - - ">"
282
+ - - ">="
283
283
  - !ruby/object:Gem::Version
284
- version: 1.3.1
284
+ version: '0'
285
285
  requirements: []
286
286
  rubyforge_project:
287
287
  rubygems_version: 2.6.6