Class: Fluent::Plugin::AzureEventHubsOutputBuffered

Inherits:
Output
  • Object
show all
Defined in:
lib/fluent/plugin/out_azureeventhubs_buffered.rb

Constant Summary collapse

DEFAULT_BUFFER_TYPE =
"memory"

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object

Raises:

  • (Fluent::ConfigError)


28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 28

def configure(conf)
  compat_parameters_convert(conf, :buffer, :inject)
  super
  case @type
  when 'amqps'
    raise NotImplementedError
  else
    require_relative 'azureeventhubs/http'
    @sender = AzureEventHubsHttpSender.new(@connection_string, @hub_name, @expiry_interval,@proxy_addr,@proxy_port,@open_timeout,@read_timeout)
  end
  raise Fluent::ConfigError, "'tag' in chunk_keys is required." if not @chunk_key_tag
end

#format(tag, time, record) ⇒ Object



41
42
43
44
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 41

def format(tag, time, record)
  record = inject_values_to_record(tag, time, record)
  [tag, time, record].to_msgpack
end

#formatted_to_msgpack_binary?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 46

def formatted_to_msgpack_binary?
  true
end

#write(chunk) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 50

def write(chunk)
  chunk.msgpack_each { |tag, time, record|
    p record.to_s
    if @include_tag
      record['tag'] = tag
    end
    if @include_time
      record[@tag_time_name] = time
    end
    @sender.send_w_properties(record, @message_properties)
  }
end