Class: PubsubClient::Publisher
- Inherits:
-
Object
- Object
- PubsubClient::Publisher
- Defined in:
- lib/pubsub_client/publisher.rb
Instance Method Summary collapse
- #flush ⇒ Object
-
#initialize(topic) ⇒ Publisher
constructor
A new instance of Publisher.
- #publish(message, attributes = {}, &block) ⇒ Object
Constructor Details
#initialize(topic) ⇒ Publisher
Returns a new instance of Publisher.
8 9 10 |
# File 'lib/pubsub_client/publisher.rb', line 8 def initialize(topic) @topic = topic end |
Instance Method Details
#flush ⇒ Object
16 17 18 19 |
# File 'lib/pubsub_client/publisher.rb', line 16 def flush return unless topic.async_publisher topic.async_publisher.stop.wait! end |
#publish(message, attributes = {}, &block) ⇒ Object
12 13 14 |
# File 'lib/pubsub_client/publisher.rb', line 12 def publish(, attributes = {}, &block) topic.publish_async(, attributes, &block) end |