google-pubsub-enhancer 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c24a1692b79fc980b6a1c4b7d400ceae6fa29a2
|
4
|
+
data.tar.gz: acf5bae2cf05a35b8bed3fd0284e901c8b962e05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0569fe92aecf7244ea9e5a78ab5a9987e01c651d354e38ffbd8ddfdf6222ede4cfc1b74fc32c4dd55cfb824bd5b282769e99266c54653e3c1667993e49ecd1f8
|
7
|
+
data.tar.gz: aaaeda31795661b22989279bab17a0f1bde16fe96da67e66cec815398ace6f5d10d762e5559d8fc979a180ad08d79a602682c0ace974fc32306890e1195282a5
|
@@ -43,6 +43,7 @@ class GooglePubsubEnhancer
|
|
43
43
|
while received_messages = subscription.pull(:max => GooglePubsubEnhancer::Constants::MAX_PULL_SIZE)
|
44
44
|
break if opts[:shutdown].call || received_messages == nil
|
45
45
|
next if received_messages.empty?
|
46
|
+
@logger.debug{"#{received_messages.length} messages received"}
|
46
47
|
@stack.call({received_messages: received_messages})
|
47
48
|
subscription.acknowledge(received_messages)
|
48
49
|
end
|
@@ -5,10 +5,12 @@ class GooglePubsubEnhancer::Middleware::Publisher
|
|
5
5
|
@short_topic_name = opts[:short_topic_name] || raise
|
6
6
|
@full_topic_name = GooglePubsubEnhancer.name_by('topics',@short_topic_name)
|
7
7
|
@messages_key = opts[:messages] || raise
|
8
|
+
@logger = opts[:logger] || Logger.new(STDOUT)
|
8
9
|
@google_cloud_pubsub ||= Google::Cloud::Pubsub.new
|
9
10
|
end
|
10
11
|
|
11
12
|
def call(env)
|
13
|
+
@logger.debug("#{env[@messages_key].length} messages published")
|
12
14
|
@google_cloud_pubsub.publish(@full_topic_name) do |publisher|
|
13
15
|
[*env[@messages_key]].each do |m|
|
14
16
|
publisher.publish(m)
|