Class: Gcpc::Subscriber
- Inherits:
-
Object
- Object
- Gcpc::Subscriber
- Extended by:
- Forwardable
- Defined in:
- lib/gcpc/subscriber.rb,
lib/gcpc/subscriber/engine.rb,
lib/gcpc/subscriber/base_handler.rb,
lib/gcpc/subscriber/handle_engine.rb,
lib/gcpc/subscriber/default_logger.rb,
lib/gcpc/subscriber/base_interceptor.rb,
lib/gcpc/subscriber/subscription_client.rb
Defined Under Namespace
Classes: BaseHandler, BaseInterceptor, Engine, HandleEngine, SubscriptionClient
Constant Summary collapse
- DefaultLogger =
Logger.new(STDOUT)
Instance Method Summary collapse
-
#initialize(project_id:, subscription:, credentials: nil, emulator_host: nil, interceptors: [], ack_immediately: false, logger: DefaultLogger) ⇒ Subscriber
constructor
A new instance of Subscriber.
Constructor Details
#initialize(project_id:, subscription:, credentials: nil, emulator_host: nil, interceptors: [], ack_immediately: false, logger: DefaultLogger) ⇒ Subscriber
Returns a new instance of Subscriber.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/gcpc/subscriber.rb', line 17 def initialize( project_id:, subscription:, credentials: nil, emulator_host: nil, interceptors: [], ack_immediately: false, logger: DefaultLogger ) subscription_client = SubscriptionClient.new( project_id: project_id, subscription_name: subscription, credentials: credentials, emulator_host: emulator_host, ) s = subscription_client.get if s.nil? raise "Getting subscription \"#{subscription}\" from project \"#{project_id}\" failed! The subscription \"#{subscription}\" does not exist!" end @engine = Engine.new( subscription: s, interceptors: interceptors, ack_immediately: ack_immediately, logger: logger, ) end |