Class: Fluent::GcloudPubSub::Subscriber
- Inherits:
-
Object
- Object
- Fluent::GcloudPubSub::Subscriber
- Defined in:
- lib/fluent/plugin/gcloud_pubsub/client.rb
Instance Method Summary collapse
- #acknowledge(messages) ⇒ Object
-
#initialize(project, key, topic, subscription) ⇒ Subscriber
constructor
A new instance of Subscriber.
- #pull(immediate, max) ⇒ Object
Constructor Details
#initialize(project, key, topic, subscription) ⇒ Subscriber
Returns a new instance of Subscriber.
30 31 32 33 34 35 |
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 30 def initialize(project, key, topic, subscription) pubsub = Google::Cloud::Pubsub.new project: project, keyfile: key topic = pubsub.topic topic @client = topic.subscription subscription raise Error.new "subscription:#{subscription} does not exist." if @client.nil? end |
Instance Method Details
#acknowledge(messages) ⇒ Object
41 42 43 |
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 41 def acknowledge() @client.acknowledge end |
#pull(immediate, max) ⇒ Object
37 38 39 |
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 37 def pull(immediate, max) @client.pull immediate: immediate, max: max end |