circuitry 3.1.1 → 3.1.2

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: 95884450075da2bde6359a923037db59ddaee7f6
4
- data.tar.gz: 7b56e6c314947463b2d95627ec622632a9fe60d0
3
+ metadata.gz: 4bc47aba6103b9002f8ebb2bf01d117f70886734
4
+ data.tar.gz: 196235821765465563e4024ca84ffdd7c1073840
5
5
  SHA512:
6
- metadata.gz: 9d9000bb3af034d32c012a6610c1f2a791b7f1af3192e276d9901075828ee0a2a8221d5dc5f01b10c18cd8bf5c92348b1d4fea54a738e4136b1f9b17546e22b1
7
- data.tar.gz: 3a810f4b53a4eb4c4e5227e6e877fe69bcc2cef12a22c2205854782f1cf174670d84159224eabf310e482a68bffa80dfce5e40377f287076d8e66847689d8864
6
+ metadata.gz: ec1fd3a9ec9a9439017ccb71ce08910de261630ca1b7e49cbe309271260cebf2fde55e6a232ab57e63e9567594440f657fc2ff29e52d46cd92ce2f55d916670a
7
+ data.tar.gz: 9e401d50cfbc1c3a3f17219410f6b88da1653e7ce850969bafef5784d321c3274df29c5642df5ec7e9eb6f7bbc9da7da5058693601ba839f5dcf05ddcd11e3f9
@@ -1,3 +1,7 @@
1
+ ## Circuitry 3.1.2 (Mar 4, 2016)
2
+
3
+ * Reimplemented subscriber-only flush middleware. *Matt Huggins*
4
+
1
5
  ## Circuitry 3.1.1 (Mar 3, 2016)
2
6
 
3
7
  * Removed flush middleware. *Matt Huggins*
data/README.md CHANGED
@@ -555,6 +555,16 @@ your middleware:
555
555
  * `#clear`: Removes all middleware classes from the chain.
556
556
  * `middleware.clear`
557
557
 
558
+ ### Default Subscriber Middleware:
559
+
560
+ * `Circuitry::Middleware::Entries::Flush`: ensures any pending async publishes are run after a
561
+ message is received. Useful for publishes that happen as a result of processing received
562
+ messages.
563
+
564
+ ### Default Publisher Middleware:
565
+
566
+ None.
567
+
558
568
  ## Testing
559
569
 
560
570
  Circuitry provides a simple option for testing publishing and subscribing without actually hitting
@@ -11,6 +11,12 @@ module Circuitry
11
11
  validate_setting(value, Publisher.async_strategies)
12
12
  super
13
13
  end
14
+
15
+ def middleware
16
+ @middleware ||= Middleware::Chain.new
17
+ yield @middleware if block_given?
18
+ @middleware
19
+ end
14
20
  end
15
21
  end
16
22
  end
@@ -16,12 +16,6 @@ module Circuitry
16
16
  base.attribute :async_strategy, Symbol, default: ->(_page, _att) { :fork }
17
17
  end
18
18
 
19
- def middleware
20
- @_middleware ||= Middleware::Chain.new
21
- yield @_middleware if block_given?
22
- @_middleware
23
- end
24
-
25
19
  def aws_options
26
20
  {
27
21
  access_key_id: access_key,
@@ -1,5 +1,6 @@
1
1
  require 'virtus'
2
2
  require 'circuitry/config/shared_settings'
3
+ require 'circuitry/middleware/entries/flush'
3
4
 
4
5
  module Circuitry
5
6
  module Config
@@ -27,6 +28,16 @@ module Circuitry
27
28
  raise ConfigError, "invalid lock strategy \"#{value.inspect}\""
28
29
  end
29
30
  end
31
+
32
+ def middleware
33
+ @middleware ||= Middleware::Chain.new do |middleware|
34
+ middleware.add Middleware::Entries::Flush
35
+ end
36
+
37
+ yield @middleware if block_given?
38
+
39
+ @middleware
40
+ end
30
41
  end
31
42
  end
32
43
  end
@@ -0,0 +1,16 @@
1
+ module Circuitry
2
+ module Middleware
3
+ module Entries
4
+ class Flush
5
+ def initialize(_options = {})
6
+ end
7
+
8
+ def call(_topic, _message)
9
+ yield
10
+ ensure
11
+ Circuitry.flush
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  module Circuitry
2
- VERSION = '3.1.1'
2
+ VERSION = '3.1.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circuitry
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Huggins
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2016-03-03 00:00:00.000000000 Z
12
+ date: 2016-03-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -258,6 +258,7 @@ files:
258
258
  - lib/circuitry/locks/redis.rb
259
259
  - lib/circuitry/message.rb
260
260
  - lib/circuitry/middleware/chain.rb
261
+ - lib/circuitry/middleware/entries/flush.rb
261
262
  - lib/circuitry/middleware/entry.rb
262
263
  - lib/circuitry/processor.rb
263
264
  - lib/circuitry/processors/batcher.rb