google-pubsub-enhancer 0.5.0 → 0.5.1
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 +4 -4
- data/.gitignore +1 -0
- data/google-pubsub-enhancer.gemspec +2 -2
- data/lib/google_pubsub_enhancer/spec.rb +5 -1
- data/lib/google_pubsub_enhancer/version.rb +1 -1
- data/lib/google_pubsub_enhancer.rb +6 -4
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e20918fd98bff1967fb4de0a621430e08266923
|
4
|
+
data.tar.gz: 4fc8547079c2d2a6681349de1b172f5709d299b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b2098a5da5eec707e25fe853c47c2c993bd3d86e2439b181507eba546e92294297eb18b7df2883e7cece5bc6d7f630c0fb2b875e196bb9111add9c73add918a
|
7
|
+
data.tar.gz: fd6108cfd7bcb53c4f45224b13b53a2d118289e477f8b35d76435449c4a8bd35a1ada97e6a58ab3d908594bbacedf6cd73b1fd5d9da0c32504ecb4ed8fcc8c5c
|
data/.gitignore
CHANGED
@@ -6,8 +6,8 @@ require 'google_pubsub_enhancer/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = "google-pubsub-enhancer"
|
8
8
|
spec.version = GooglePubsubEnhancer::VERSION
|
9
|
-
spec.authors = ["bejczib"]
|
10
|
-
spec.email = ["bejczi.balint@gmail.com"]
|
9
|
+
spec.authors = ["bejczib","karoly_bujtor"]
|
10
|
+
spec.email = ["bejczi.balint@gmail.com","bujtor.karoly@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Enhancement for a pipeline built with Google PubSub Services }
|
13
13
|
spec.homepage = "http://github.com/bejczib/google-pubsub-enhancer"
|
@@ -6,7 +6,7 @@ module GooglePubsubEnhancer::Spec
|
|
6
6
|
let(:publisher) { double "publisher"}
|
7
7
|
let(:subscription) { double 'subscription'}
|
8
8
|
before do
|
9
|
-
|
9
|
+
ENV['PUBSUB_KEYFILE_JSON'] = JSON.dump(project_id: 'cica')
|
10
10
|
allow(Google::Cloud::Pubsub).to receive(:new).and_return(pubsub)
|
11
11
|
allow(pubsub).to receive(:publish).and_yield(publisher)
|
12
12
|
allow(pubsub).to receive(:subscription).and_return subscription
|
@@ -14,6 +14,10 @@ module GooglePubsubEnhancer::Spec
|
|
14
14
|
allow(publisher).to receive(:publish)
|
15
15
|
allow(subscription).to receive(:acknowledge)
|
16
16
|
end
|
17
|
+
|
18
|
+
after do
|
19
|
+
ENV.delete 'PUBSUB_KEYFILE_JSON'
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
@@ -19,7 +19,7 @@ class GooglePubsubEnhancer
|
|
19
19
|
key = ::Google::Cloud::Pubsub::Credentials::JSON_ENV_VARS.find { |n| !ENV[n].nil? }
|
20
20
|
@pubsub_config ||= JSON.parse(ENV[key])
|
21
21
|
rescue => ex
|
22
|
-
raise Exception,
|
22
|
+
raise Exception, "Environment not setted properly"
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
@@ -45,15 +45,17 @@ class GooglePubsubEnhancer
|
|
45
45
|
break if opts[:shutdown].call || received_messages == nil
|
46
46
|
next if received_messages.empty?
|
47
47
|
@logger.debug{"#{received_messages.length} messages received"}
|
48
|
-
|
49
|
-
|
48
|
+
env = {received_messages: received_messages, nacked_messages: []}
|
49
|
+
@stack.call(env)
|
50
|
+
p env
|
51
|
+
subscription.acknowledge(env[:received_messages] - env[:nacked_messages])
|
50
52
|
end
|
51
53
|
end
|
52
54
|
|
53
55
|
def create_subscription(subscription_short_name)
|
54
56
|
Google::Cloud::Pubsub.new.subscription(self.class.name_by('subscriptions', subscription_short_name))
|
55
57
|
rescue => ex
|
56
|
-
raise Exception, '
|
58
|
+
raise Exception, 'Problem with subscription. Check spelling or permissions!'
|
57
59
|
end
|
58
60
|
|
59
61
|
def configurate_options(opts)
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-pubsub-enhancer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bejczib
|
8
|
+
- karoly_bujtor
|
8
9
|
autorequire:
|
9
10
|
bindir: exe
|
10
11
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
12
|
+
date: 2017-03-13 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: bundler
|
@@ -83,6 +84,7 @@ dependencies:
|
|
83
84
|
description:
|
84
85
|
email:
|
85
86
|
- bejczi.balint@gmail.com
|
87
|
+
- bujtor.karoly@gmail.com
|
86
88
|
executables: []
|
87
89
|
extensions: []
|
88
90
|
extra_rdoc_files: []
|