Class: Google::Cloud::PubSub::BatchPublisher
- Inherits:
-
Object
- Object
- Google::Cloud::PubSub::BatchPublisher
- Defined in:
- lib/google/cloud/pubsub/batch_publisher.rb
Overview
Topic Batch Publisher object used to publish multiple messages at once.
Instance Method Summary collapse
-
#publish(data, attributes = nil, ordering_key: nil, **extra_attrs) ⇒ Object
Add a message to the batch to be published to the topic.
Instance Method Details
#publish(data, attributes = nil, ordering_key: nil, **extra_attrs) ⇒ Object
Add a message to the batch to be published to the topic. All messages added to the batch will be published at once. See Topic#publish
96 97 98 99 100 |
# File 'lib/google/cloud/pubsub/batch_publisher.rb', line 96 def publish data, attributes = nil, ordering_key: nil, **extra_attrs msg = Convert. data, attributes, ordering_key, extra_attrs @total_message_bytes += msg.data.bytesize + 2 @messages << msg end |