Sha256: be9b238debd5c9811b1841bf18863e9838c9739e1964800118e5256817b91512
Contents?: true
Size: 528 Bytes
Versions: 2
Compression:
Stored size: 528 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 @google_cloud_pubsub ||= Google::Cloud::Pubsub.new end def call(env) @google_cloud_pubsub.publish(@full_topic_name) do |publisher| [*env[@messages_key]].each do |m| publisher.publish(m) end end @app.call(env) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
google-pubsub-enhancer-0.1.3 | lib/google_pubsub_enhancer/publisher.rb |
google-pubsub-enhancer-0.1.2 | lib/google_pubsub_enhancer/publisher.rb |