Class: PubsubClient::SubscriberFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/pubsub_client/subscriber_factory.rb

Instance Method Summary collapse

Constructor Details

#initializeSubscriberFactory

Returns a new instance of SubscriberFactory.



7
8
9
# File 'lib/pubsub_client/subscriber_factory.rb', line 7

def initialize
  @subscribers = {}
end

Instance Method Details

#build(subscription_name) ⇒ Object

Parameters:

  • subscription_name (String)


13
14
15
16
17
18
19
# File 'lib/pubsub_client/subscriber_factory.rb', line 13

def build(subscription_name)
  if @subscribers.key?(subscription_name)
    raise ConfigurationError, "PubsubClient already subscribed to #{subscription_name}"
  end

  @subscribers[subscription_name] = build_subscriber(subscription_name)
end