Sha256: 0867f5e80c1077c7d2b6cbbca1a7b6cbad137f0c93bd8d94ed8ae17bb4106e66
Contents?: true
Size: 546 Bytes
Versions: 1
Compression:
Stored size: 546 Bytes
Contents
class GooglePubsubEnhancer::Publisher def initialize(app, opts={}) @app = app @short_topic_name = opts[:short_topic_name] || raise @full_topic_name = GooglePubsubEnhancer.name_by('topics',@short_topic_name) @messages_key = opts[:messages] || raise end def call(env) google_cloud_pubsub.publish(@full_topic_name) do |publisher| [*env[@messages_key]].each do |m| p m publisher.publish(m) end end @app.call(env) end def google_cloud_pubsub Google::Cloud::Pubsub.new end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
google-pubsub-enhancer-0.1.0 | lib/google_pubsub_enhancer/publisher.rb |