hanami-events-cloud_pubsub 3.1.4 → 3.2.0

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
  SHA256:
3
- metadata.gz: c39281bf95b089129d91b5c00b4e73d03dfe32269c2ee9a57f8af9b69c9ebdee
4
- data.tar.gz: bf46742e1b0b73347516e53c6f140375cd38b9f5dffe595bc53b724c2d73765a
3
+ metadata.gz: ce3a1788cccaf44d604f113f700ffe69b2e198d068b6dce7ed25f85bc1c2f72a
4
+ data.tar.gz: 0cbbe24fb26de4fc989dcfc53f2cb73fccaacc58408deaae623d1d6d7e249ba2
5
5
  SHA512:
6
- metadata.gz: 14d84ed126a93b4324fccec58cbf91508e18d03cebbc7c6f214716c5974160b7f4f9164ea0e6001fb39d0702ae50596d3a6dc0c12f8f509d52356dee2d17b63e
7
- data.tar.gz: 3dd0a1882517fbbd041f4e0c8014b50f865d3af4261c6a2d8b93808b5c0be063622a74397157b9ef0cc449d9fcc404eb2ba2316a381c282da5cafad4e3313ca5
6
+ metadata.gz: 9789652777e1a651533eab9c0f68a418815ce7694b2888e4d6e01ffb0d2b8f5099cea2dbd9903fc6abb8c82b547f7107fcc3ce8356396414baa443335b2bc021
7
+ data.tar.gz: 585fc1954bc4431f5770f1eb7fb8d659c22f28726e69ecc60bdd4751e9a627de1e2f5321e142a04222a46c03d18d08aa5a6304102d8dd976b48ba0fb09aef770
@@ -54,7 +54,7 @@ module Hanami
54
54
  # @param id [String] A unique identifier for the subscriber
55
55
  # @param subscriber_opts [String] Additional options for the subscriber
56
56
  # @param block [Block] to execute when event is broadcasted
57
- def subscribe(name, id:, **subscriber_opts, &block)
57
+ def subscribe(name, id:, auto_ack: true, **subscriber_opts, &block)
58
58
  event_name = namespaced(name)
59
59
  namespaced_id = namespaced(id)
60
60
 
@@ -64,7 +64,7 @@ module Hanami
64
64
  @subscribers << sub
65
65
  topic = topic_for event_name
66
66
 
67
- register_listener(event_name, topic, namespaced_id, subscriber_opts)
67
+ register_listener(event_name, topic, namespaced_id, auto_ack, subscriber_opts)
68
68
  end
69
69
 
70
70
  def flush_messages
@@ -76,7 +76,7 @@ module Hanami
76
76
 
77
77
  attr_reader :logger
78
78
 
79
- def register_listener(event_name, topic, subscriber_id, subscriber_opts)
79
+ def register_listener(event_name, topic, subscriber_id, auto_ack, subscriber_opts)
80
80
  listener = ::Hanami::Events::CloudPubsub::Listener.new(
81
81
  subscriber_id: subscriber_id,
82
82
  event_name: event_name,
@@ -84,7 +84,8 @@ module Hanami
84
84
  logger: logger,
85
85
  topic: topic,
86
86
  subscriber_opts: subscriber_opts,
87
- dead_letter_topic: dead_letter_topic
87
+ dead_letter_topic: dead_letter_topic,
88
+ auto_ack: auto_ack
88
89
  )
89
90
 
90
91
  @listeners << listener
@@ -26,6 +26,7 @@ module Hanami
26
26
  subscriber_id:,
27
27
  subscriber_opts: {},
28
28
  middleware: CloudPubsub.config.middleware,
29
+ auto_ack: true,
29
30
  dead_letter_topic: nil)
30
31
  @topic = topic
31
32
  @logger = logger
@@ -35,6 +36,7 @@ module Hanami
35
36
  @input_subscriber_opts = subscriber_opts
36
37
  @middleware = middleware
37
38
  @dead_letter_topic = dead_letter_topic
39
+ @auto_ack = auto_ack
38
40
  end
39
41
  # rubocop:enable Metrics/ParameterLists
40
42
 
@@ -86,7 +88,7 @@ module Hanami
86
88
 
87
89
  def run_handler(message)
88
90
  middleware.invoke(message) { handler.call(message) }
89
- message.ack!
91
+ message.ack! if @auto_ack
90
92
  rescue StandardError => e
91
93
  run_error_handlers(e, message.message_id.to_s)
92
94
  message.nack! if CloudPubsub.config.auto_retry.enabled
@@ -3,7 +3,7 @@
3
3
  module Hanami
4
4
  module Events
5
5
  module CloudPubsub
6
- VERSION = '3.1.4'
6
+ VERSION = '3.2.0'
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-events-cloud_pubsub
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.4
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Ker-Seymer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-03-16 00:00:00.000000000 Z
11
+ date: 2021-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable