fluentd-plugins-pulsar 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79614c84cd86dda01b8fbf6d795a12a279519171809a07041940fa5477f41bfd
4
- data.tar.gz: b2ac3a32ec128f25534aa822c0e6c6528011400deda2f5724aa5dc9e6214199c
3
+ metadata.gz: f7e861e671a98b3fecb7a1d9a9596fc61da7e1a721a8983985dd7469623e22c8
4
+ data.tar.gz: 35190f9621eafd73f4497d8ec05372ef1894bbe27f21d9a81e84c77ba3ff503d
5
5
  SHA512:
6
- metadata.gz: 9cb51b5360bd81d4c4d3d698c6ee2a4e6358316f46358c03db94546e81dc1daac7402599e439ba29138a6b0420028ffc6ea049201887eed5936e2c3cee03da9b
7
- data.tar.gz: 209bb69022cb6bb1348343a2a85bf268a40044eb773aa443e8bb6c07c1f45fbfa30f5da3d54a06f4aea34b18275de8cad2b1585071b20a5de869d05d5e13e13c
6
+ metadata.gz: '095509f040bea7ddd357195c0de9b39651c195ad1fd85df6479b304b0d8f99290f9d243147d193a12e4fa27a29841eaf2023f9a6a39ec880df234faee723a627'
7
+ data.tar.gz: 35a9c666dd180782aceb7dfcfbefd7a8b880acc49b8af577fbfd80850124168a71ee9af330ad56fb0ea2cb277cb21efa06121cd1f4d845c3a4b6a6d354883e6e
@@ -1,15 +1,15 @@
1
1
 
2
2
  require "fluent/plugin/output"
3
- require 'pulsar_client/PulsarClient'
3
+ require './pulsar_client/PulsarClient'
4
4
  module Fluent
5
5
  module Plugin
6
6
  class PulsarOutput < Fluent::Plugin::Output
7
7
  Fluent::Plugin.register_input('out_pulsar', self)
8
8
  # config Parameters
9
9
  desc 'The port of pulsar.'
10
- config_param :pulsar_port, :integer, default: 6650
10
+ config_param :pulsar_port, :integer, default: nil
11
11
  desc 'The host of pulsar.'
12
- config_param :pulsar_host, :string, default: 'pulsar-proxy.pulsar'
12
+ config_param :pulsar_host, :string, default: nil
13
13
  desc 'The topic of pulsar.'
14
14
  config_param :pulsar_topic, :string, default: 'persistent://pulsar/logs/default-topic'
15
15
  desc 'The name of producer.'
@@ -18,37 +18,41 @@ module Fluent
18
18
  config_param :num_messages, :int, default: 1
19
19
  desc 'The number of retries'
20
20
  config_param :num_retry, :int, default: 1
21
+ desc ''
21
22
  config_section :parse do
22
23
  config_set_default :@type, 'out_pulsar'
23
24
  end
25
+
24
26
  def configure(conf)
25
27
  super
28
+ end
26
29
 
30
+ def refresh_brokers(raise_error = true)
31
+ begin
32
+ if @pulsar_host != nil && @pulsar_port != nil
33
+ @producer = Message::PulsarClient.new()
34
+ @producer.connect(@pulsar_host, @pulsar_port)
35
+ log.info "Connected to pulsar brokers successfully"
36
+ end
37
+ rescue Exception => e
38
+ if raise_error
39
+ raise e
40
+ else
41
+ log.error e
42
+ end
43
+ end
27
44
  end
45
+
28
46
  def start
29
47
  super
30
- client = Message::PulsarClient.new()
31
- client.connect(@pulsar_host, @pulsar_port)
32
- log.info "Connected to pulsar brokers successfully"
33
- end
34
- def process(tag,es)
35
- es.each do |time,record|
36
- log.debug "Producing records to #{@pulsar_topic}"
37
- send_to_pulsar(record)
38
- end
48
+ refresh_brokers
39
49
  end
40
- def send_to_pulsar(record)
41
- retry_count = 0
42
- if client.send(@pulsar_topic, @pulsar_producer, @num_messages, record) == true
43
- log.info "Successfully sent a record"
44
- else
45
- log.warn "Failed to send, retrying.."
46
- retry_count += 1
47
- if (retry_count <= @num_retry)
48
- send_to_pulsar(record)
49
- else
50
- log.error "retry limit exceeded, dropping record.."
51
- end
50
+
51
+ def proces(tag,es)
52
+ es.each do |time, record|
53
+ log.debug "Publishing records to #{@pulsar_topic}"
54
+ @producer.send(@pulsar_topic,@pulsar_producer,@num_messages,record)
55
+ log.debug "Successfully sent a record to #{@pulsar_topic}"
52
56
  end
53
57
  end
54
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd-plugins-pulsar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sai Theja K
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-24 00:00:00.000000000 Z
11
+ date: 2020-01-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: " "
14
14
  email: sai.theja1008@gmail.com