action_subscriber 2.4.0 → 2.5.0.pre

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: c72fc51c6d4da298f4078aab4dcc8c47846924a7
4
- data.tar.gz: e3c4b28775c6253411f578cc76c205bb63df499f
3
+ metadata.gz: bbba2d8f10337f7f4ed5b07d542d3fab0c7a822c
4
+ data.tar.gz: 37813575c5a5c88b61bdd99594794b649e8b82df
5
5
  SHA512:
6
- metadata.gz: 301ff28f924717c44385d6aeb5debc64b998fbdfa4c3808e0e5b7ce083ffafffeb285fca145ab65c3c6e0b483c354cba13c3b4c66dc764e397897c1aa43a07e5
7
- data.tar.gz: 284132f6ff0c53f460e337c7e20d4d2d98ba75e04dbf5ba68f23368a69b913830b9b69a4057818aa98d2f26b9967a36cd03cb807dac1247d2a2955fc4801212f
6
+ metadata.gz: 8e838f5d455228a31af45060733e8a5b471c8c8e1be88e98804ba10cdee347d0647019c34fff9f269947812430ab042922261be6f9555912ebd445fc01e921ac
7
+ data.tar.gz: 6bf2c26d643c144cee46696888ef072037577b960ac5608246aa7103ff14ed82b32dde9d03aca50311663e599b6c1b22da1f8d08227b9cb5daf6239966f43f58
data/.travis.yml CHANGED
@@ -1,10 +1,7 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9
4
- - 2.0
5
- - 2.1
6
- - 2.2
7
- - jruby-1.7
3
+ - 2.2.4
4
+ - 2.3.0
8
5
  - jruby-9.0.4.0
9
6
  - jruby-head
10
7
  - rbx-2
@@ -61,17 +61,73 @@ module ActionSubscriber
61
61
  end
62
62
 
63
63
  def _at_least_once_filter
64
+ processed_acknowledgement = false
64
65
  yield
65
- acknowledge
66
+ processed_acknowledgement = acknowledge
66
67
  rescue => error
67
68
  ::ActionSubscriber::MessageRetry.redeliver_message_with_backoff(env)
68
- acknowledge
69
+ processed_acknowledgement = acknowledge
69
70
  raise error
71
+ ensure
72
+ rejected_message = false
73
+ rejected_message = reject unless processed_acknowledgement
74
+
75
+ if !processed_acknowledgement && !rejected_message
76
+ Process.kill(:TTIN, Process.pid)
77
+ Process.kill(:USR2, Process.pid)
78
+
79
+ $stdout << <<-UNREJECTABLE
80
+ CANNOT ACKNOWLEDGE OR REJECT THE MESSAGE
81
+
82
+ This is a exceptional state for ActionSubscriber to enter and puts the current
83
+ Process in the position of "I can't get new work from RabbitMQ, but also
84
+ can't acknowledge or reject the work that I currently have" ... While rare
85
+ this state can happen.
86
+
87
+ Instead of continuing to try to process the message ActionSubscriber is
88
+ sending a Kill signal to the current running process to gracefully shutdown
89
+ so that the RabbitMQ server will purge any outstanding acknowledgements. If
90
+ you are running a process monitoring tool (like Upstart) the Subscriber
91
+ process will be restarted and be able to take on new work.
92
+
93
+ ** Running a process monitoring tool like Upstart is recommended for this reason **
94
+ UNREJECTABLE
95
+
96
+ Process.kill(:TERM, Process.pid)
97
+ end
70
98
  end
71
99
 
72
100
  def _at_most_once_filter
73
- acknowledge
101
+ processed_acknowledgement = false
102
+ processed_acknowledgement = acknowledge
74
103
  yield
104
+ ensure
105
+ rejected_message = false
106
+ rejected_message = reject unless processed_acknowledgement
107
+
108
+ if !processed_acknowledgement && !rejected_message
109
+ Process.kill(:TTIN, Process.pid)
110
+ Process.kill(:USR2, Process.pid)
111
+
112
+ $stdout << <<-UNREJECTABLE
113
+ CANNOT ACKNOWLEDGE OR REJECT THE MESSAGE
114
+
115
+ This is a exceptional state for ActionSubscriber to enter and puts the current
116
+ Process in the position of "I can't get new work from RabbitMQ, but also
117
+ can't acknowledge or reject the work that I currently have" ... While rare
118
+ this state can happen.
119
+
120
+ Instead of continuing to try to process the message ActionSubscriber is
121
+ sending a Kill signal to the current running process to gracefully shutdown
122
+ so that the RabbitMQ server will purge any outstanding acknowledgements. If
123
+ you are running a process monitoring tool (like Upstart) the Subscriber
124
+ process will be restarted and be able to take on new work.
125
+
126
+ ** Running a process monitoring tool like Upstart is recommended for this reason **
127
+ UNREJECTABLE
128
+
129
+ Process.kill(:TERM, Process.pid)
130
+ end
75
131
  end
76
132
 
77
133
  def reject
@@ -43,11 +43,13 @@ module ActionSubscriber
43
43
  def acknowledge
44
44
  acknowledge_multiple_messages = false
45
45
  @channel.ack(@delivery_tag, acknowledge_multiple_messages)
46
+ true
46
47
  end
47
48
 
48
49
  def reject
49
50
  requeue_message = true
50
51
  @channel.reject(@delivery_tag, requeue_message)
52
+ true
51
53
  end
52
54
 
53
55
  def to_hash
@@ -1,3 +1,3 @@
1
1
  module ActionSubscriber
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0.pre"
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: 2.4.0
4
+ version: 2.5.0.pre
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-04-11 00:00:00.000000000 Z
15
+ date: 2016-09-09 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: activesupport
@@ -272,12 +272,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
272
272
  version: '0'
273
273
  required_rubygems_version: !ruby/object:Gem::Requirement
274
274
  requirements:
275
- - - ">="
275
+ - - ">"
276
276
  - !ruby/object:Gem::Version
277
- version: '0'
277
+ version: 1.3.1
278
278
  requirements: []
279
279
  rubyforge_project:
280
- rubygems_version: 2.5.2
280
+ rubygems_version: 2.5.1
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: ActionSubscriber is a DSL that allows a rails app to consume messages from