magic_pipe 0.3.0 → 0.4.0
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 +5 -5
- data/.travis.yml +3 -3
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +4 -4
- data/lib/magic_pipe/errors.rb +12 -0
- data/lib/magic_pipe/senders/async.rb +1 -1
- data/lib/magic_pipe/senders/sync.rb +1 -1
- data/lib/magic_pipe/transports/base.rb +2 -2
- data/lib/magic_pipe/transports/debug.rb +1 -1
- data/lib/magic_pipe/transports/https.rb +6 -2
- data/lib/magic_pipe/transports/log.rb +1 -1
- data/lib/magic_pipe/transports/multi.rb +2 -2
- data/lib/magic_pipe/transports/sqs.rb +4 -1
- data/lib/magic_pipe/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1e62bd485afca6636d7eaf6f1012626e56ab2487bc5a14c0907b16ee1b31719d
|
4
|
+
data.tar.gz: 52f3fd7a732204f997db9d9f94287ad5f6874ae652a98cd030a0ffba2653afd6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e010cb398432c0bd5282bdce573aeb4208a8001c01a69e63028f5b0dbe72bbf2b058c530c470d9ca91a33b13fcd8306467725a2826227bedcbc5aa61b4a28437
|
7
|
+
data.tar.gz: 1322dbfd131696b6a80497e1701354943d2e497cab23842cad51d108afc2f380c3854dc537940dec20bbd6983457be47e5f0831b3f06571dd6cce7e25e4afcdb
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# MagicPipe Changelog
|
2
2
|
|
3
|
+
## v0.4.0
|
4
|
+
|
5
|
+
Bug fix: Ensure that the `Https` transport raises an exception when the HTTP POST request fails.
|
6
|
+
|
3
7
|
## v0.3.0
|
4
8
|
|
5
9
|
* Allow to set the `basic_auth` config as a proc which gets the topic name passed. (thanks @Crunch09, https://github.com/tompave/magic_pipe/pull/1)
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
magic_pipe (0.
|
4
|
+
magic_pipe (0.4.0)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -25,9 +25,9 @@ GEM
|
|
25
25
|
diff-lcs (1.3)
|
26
26
|
ethon (0.11.0)
|
27
27
|
ffi (>= 1.3.0)
|
28
|
-
faraday (0.
|
28
|
+
faraday (0.15.3)
|
29
29
|
multipart-post (>= 1.2, < 3)
|
30
|
-
ffi (1.9.
|
30
|
+
ffi (1.9.25)
|
31
31
|
hashdiff (0.3.7)
|
32
32
|
jmespath (1.3.1)
|
33
33
|
method_source (0.9.0)
|
@@ -89,4 +89,4 @@ DEPENDENCIES
|
|
89
89
|
webmock (~> 3.3)
|
90
90
|
|
91
91
|
BUNDLED WITH
|
92
|
-
1.16.
|
92
|
+
1.16.4
|
data/lib/magic_pipe/errors.rb
CHANGED
@@ -11,4 +11,16 @@ module MagicPipe
|
|
11
11
|
end
|
12
12
|
attr_reader :message
|
13
13
|
end
|
14
|
+
|
15
|
+
module Transports
|
16
|
+
class SubmitFailedError < MagicPipe::Error
|
17
|
+
def initialize(transport_klass)
|
18
|
+
@message = "#{transport_klass} couldn't submit message"
|
19
|
+
end
|
20
|
+
attr_reader :message
|
21
|
+
end
|
22
|
+
|
23
|
+
class NotImplementedError < SubmitFailedError
|
24
|
+
end
|
25
|
+
end
|
14
26
|
end
|
@@ -10,7 +10,7 @@ module MagicPipe
|
|
10
10
|
metadata = build_metadata
|
11
11
|
envelope = build_message(metadata)
|
12
12
|
payload = @codec.new(envelope).encode
|
13
|
-
@transport.submit(payload, metadata)
|
13
|
+
@transport.submit!(payload, metadata)
|
14
14
|
track_success(@metrics, @topic)
|
15
15
|
rescue => e
|
16
16
|
track_failure(@metrics, @topic)
|
@@ -20,10 +20,10 @@ module MagicPipe
|
|
20
20
|
# TODO: should this raise an error on failure?
|
21
21
|
# So that it can be retried?
|
22
22
|
#
|
23
|
-
def submit(payload, metadata)
|
23
|
+
def submit!(payload, metadata)
|
24
24
|
username, password = basic_auth(metadata[:topic])
|
25
25
|
@conn.basic_auth(username, password || "x")
|
26
|
-
@conn.post do |r|
|
26
|
+
resp = @conn.post do |r|
|
27
27
|
path = dynamic_path(metadata[:topic])
|
28
28
|
r.url(path) if path
|
29
29
|
|
@@ -32,6 +32,10 @@ module MagicPipe
|
|
32
32
|
r.headers["X-MagicPipe-Topic"] = metadata[:topic]
|
33
33
|
r.headers["X-MagicPipe-Producer"] = metadata[:producer]
|
34
34
|
end
|
35
|
+
|
36
|
+
unless resp.success?
|
37
|
+
raise SubmitFailedError, self.class
|
38
|
+
end
|
35
39
|
end
|
36
40
|
|
37
41
|
|
@@ -9,10 +9,10 @@ module MagicPipe
|
|
9
9
|
end
|
10
10
|
|
11
11
|
|
12
|
-
def submit(payload, metadata)
|
12
|
+
def submit!(payload, metadata)
|
13
13
|
@transports.map do |transport|
|
14
14
|
begin
|
15
|
-
transport.submit(payload, metadata)
|
15
|
+
transport.submit!(payload, metadata)
|
16
16
|
rescue => e
|
17
17
|
log_error(e, transport)
|
18
18
|
end
|
data/lib/magic_pipe/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magic_pipe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tommaso Pavese
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -248,7 +248,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
248
248
|
version: '0'
|
249
249
|
requirements: []
|
250
250
|
rubyforge_project:
|
251
|
-
rubygems_version: 2.
|
251
|
+
rubygems_version: 2.7.7
|
252
252
|
signing_key:
|
253
253
|
specification_version: 4
|
254
254
|
summary: A Magic Pipe to send data in arbitrary formats to configurable backends,
|