Class: Fluent::Plugin::AzureEventHubsOutputBuffered
- Inherits:
-
Output
- Object
- Output
- Fluent::Plugin::AzureEventHubsOutputBuffered
- Defined in:
- lib/fluent/plugin/out_azureeventhubs_buffered.rb
Constant Summary collapse
- DEFAULT_BUFFER_TYPE =
"memory"
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #enrich_record(tag, time, record) ⇒ Object
- #format(tag, time, record) ⇒ Object
- #formatted_to_msgpack_binary? ⇒ Boolean
- #write(chunk) ⇒ Object
- #write_batched(chunk) ⇒ Object
- #write_singularly(chunk) ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 31 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 |
#enrich_record(tag, time, record) ⇒ Object
84 85 86 87 88 89 90 91 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 84 def enrich_record(tag, time, record) if @include_tag record['tag'] = tag end if @include_time record[@tag_time_name] = time end end |
#format(tag, time, record) ⇒ Object
44 45 46 47 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 44 def format(tag, time, record) record = inject_values_to_record(tag, time, record) [tag, time, record].to_msgpack end |
#formatted_to_msgpack_binary? ⇒ Boolean
49 50 51 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 49 def formatted_to_msgpack_binary? true end |
#write(chunk) ⇒ Object
53 54 55 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 53 def write(chunk) @batch ? write_batched(chunk) : write_singularly(chunk) end |
#write_batched(chunk) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 67 def write_batched(chunk) records = [] chunk.msgpack_each { |tag, time, record| if @print_records p record.to_s end enrich_record(tag, time, record) records << record } records.each_slice(@max_batch_size).each { |group| payload = group @sender.send_w_properties(payload, @message_properties) } end |
#write_singularly(chunk) ⇒ Object
57 58 59 60 61 62 63 64 65 |
# File 'lib/fluent/plugin/out_azureeventhubs_buffered.rb', line 57 def write_singularly(chunk) chunk.msgpack_each { |tag, time, record| if @print_records p record.to_s end enrich_record(tag, time, record) @sender.send_w_properties(record, @message_properties) } end |