Class: Gcpc::Publisher
- Inherits:
-
Object
- Object
- Gcpc::Publisher
- Extended by:
- Forwardable
- Defined in:
- lib/gcpc/publisher.rb,
lib/gcpc/publisher/engine.rb,
lib/gcpc/publisher/topic_client.rb,
lib/gcpc/publisher/base_interceptor.rb,
lib/gcpc/publisher/engine/batch_engine.rb,
lib/gcpc/publisher/engine/chained_interceptor.rb
Defined Under Namespace
Classes: BaseInterceptor, Engine, TopicClient
Instance Method Summary collapse
-
#initialize(project_id:, topic:, credentials: nil, emulator_host: nil, interceptors: []) ⇒ Publisher
constructor
A new instance of Publisher.
Constructor Details
#initialize(project_id:, topic:, credentials: nil, emulator_host: nil, interceptors: []) ⇒ Publisher
Returns a new instance of Publisher.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/gcpc/publisher.rb', line 13 def initialize( project_id:, topic:, credentials: nil, emulator_host: nil, interceptors: [] ) topic_client = TopicClient.new( project_id: project_id, topic_name: topic, credentials: credentials, emulator_host: emulator_host, ) t = topic_client.get if t.nil? raise "Getting topic \"#{topic}\" from project \"#{project_id}\" failed! The topic \"#{topic}\" does not exist!" end @engine = Engine.new( topic: t, interceptors: interceptors, ) end |