Class: Fluent::GcloudPubSubInput

Inherits:
Input
  • Object
show all
Defined in:
lib/fluent/plugin/in_gcloud_pubsub.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object

Raises:

  • (Fluent::ConfigError)


26
27
28
29
30
31
32
33
# File 'lib/fluent/plugin/in_gcloud_pubsub.rb', line 26

def configure(conf)
  super

  raise Fluent::ConfigError, "'topic' must be specified." unless @topic
  raise Fluent::ConfigError, "'subscription' must be specified." unless @subscription

  configure_parser(conf)
end

#shutdownObject



50
51
52
53
54
55
# File 'lib/fluent/plugin/in_gcloud_pubsub.rb', line 50

def shutdown
  super

  @stop_subscribing = true
  @subscribe_thread.join
end

#startObject



40
41
42
43
44
45
46
47
48
# File 'lib/fluent/plugin/in_gcloud_pubsub.rb', line 40

def start
  super

  pubsub = (Gcloud.new @project, @key).pubsub
  topic = pubsub.topic @topic
  @client = topic.subscription @subscription
  @stop_subscribing = false
  @subscribe_thread = Thread.new(&method(:subscribe))
end