fluent-plugin-mqtt-io 0.3.9 → 0.3.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3782aca018e523e428d463853e6bab8419f005ca
4
- data.tar.gz: bec45595691338a9c383bb41925d14bf8815b685
3
+ metadata.gz: 8d7e986a8afcf6c7a526c13cfaea4a80804dc441
4
+ data.tar.gz: e916f2585a275b982060ea8e8b6b4ec191a37c69
5
5
  SHA512:
6
- metadata.gz: cfb2568422ebd1239ab1f50d59d9238fd0e8ccf71bd5bfe2e84487ac93580f9ab1990d64a519ae2751fd78bf7066e8258925656528e33fb79b910e2502c887af
7
- data.tar.gz: 9eba2f2086abd8f94995248e032d76aae10fe5f3a3ca204a28a1d0e752288464aca0e08ebcf9525223b706aedfc3e73a47947a60ad38c4c265bc159a6699497c
6
+ metadata.gz: dda7025caf66c87d2d35ef1e3071822b9e286710c7e173218d1d6217275c5cb1ab141788196cf6ed014b7fc2f244470758d901cf25a56c50a85b8d835841c93e
7
+ data.tar.gz: fcca2b61a66583ca4e0544624d08e88d15b4f1e0b146c88fb11fe42fd6ea111a2bcff23fd650425f92053f023fe26f07eb52e0ccfa0682f65bd0195ddc93df1d
data/README.md CHANGED
@@ -123,7 +123,8 @@ For fluent-plugin-mqtt-io ~> v0.3.0
123
123
  ```
124
124
 
125
125
  The options are basically the same as Input Plugin except for "format" and "bulk_trans" (only for Input). Additional options for Output Plugin are the following.
126
-
126
+ - **qos**: Quality of Service (QoS) for message publishing, 0 or 1 is valid. 2 is not supported by mqtt client. Default is 1.
127
+ - **retain**: If set true the broker will keep the message even after sending it to all current subscribers. Default is false
127
128
  - **time_key**: An attribute name used for timestamp field genarated from fluentd time field. Default is nil (omitted).
128
129
  If this option is omitted, timestamp field is not appended to the output record.
129
130
  - **time_format**: Output format of timestamp field. Default is ISO8601. You can specify your own format by using TimeParser.
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-mqtt-io"
7
- spec.version = "0.3.9"
7
+ spec.version = "0.3.10"
8
8
  spec.authors = ["Toyokazu Akiyama"]
9
9
  spec.email = ["toyokazu@gmail.com"]
10
10
 
@@ -110,6 +110,8 @@ module Fluent::Plugin
110
110
  retry_connect(e, "System call error occurs.")
111
111
  rescue StandardError=> e
112
112
  retry_connect(e, "The other error occurs.")
113
+ rescue MQTT::NotConnectedException=> e
114
+ retry_connect(e, "MQTT not connected exception occurs.")
113
115
  end
114
116
  end
115
117
 
@@ -18,6 +18,11 @@ module Fluent::Plugin
18
18
  desc 'Topic rewrite replacement string.'
19
19
  config_param :topic_rewrite_replacement, :string, default: nil
20
20
 
21
+ desc 'Retain option which publishing'
22
+ config_param :retain, :bool, default: false
23
+ desc 'QoS option which publishing'
24
+ config_param :qos, :integer, default: 1
25
+
21
26
  config_section :format do
22
27
  desc 'The format to publish'
23
28
  config_param :@type, :string, default: 'single_value'
@@ -139,7 +144,12 @@ module Fluent::Plugin
139
144
  chunk.each do |tag, time, record|
140
145
  rescue_disconnection do
141
146
  log.debug "MqttOutput#write: #{rewrite_tag(rewrite_tag(tag))}, #{time}, #{add_send_time(record)}"
142
- @client.publish(rewrite_tag(tag), @formatter.format(tag, time, add_send_time(record)))
147
+ @client.publish(
148
+ rewrite_tag(tag),
149
+ @formatter.format(tag, time, add_send_time(record)),
150
+ @retain,
151
+ @qos
152
+ )
143
153
  end
144
154
  end
145
155
  end
@@ -21,6 +21,8 @@ class MqttOutputTest < Test::Unit::TestCase
21
21
  host 127.0.0.1
22
22
  port 1300
23
23
  client_id aa-bb-cc-dd
24
+ retain true
25
+ qos 2
24
26
  <format>
25
27
  @type json
26
28
  </format>
@@ -39,6 +41,8 @@ class MqttOutputTest < Test::Unit::TestCase
39
41
  assert_equal '127.0.0.1', d.instance.host
40
42
  assert_equal 1300, d.instance.port
41
43
  assert_equal true, d.instance.monitor.send_time
44
+ assert_equal true, d.instance.retain
45
+ assert_equal 2, d.instance.qos
42
46
  assert_equal 'aa-bb-cc-dd', d.instance.client_id
43
47
 
44
48
  assert_equal true, d.instance.security.use_tls
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-mqtt-io
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toyokazu Akiyama
8
8
  autorequire:
9
9
  bindir: []
10
10
  cert_chain: []
11
- date: 2018-01-05 00:00:00.000000000 Z
11
+ date: 2018-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd