fluent-plugin-mqtt-io 0.3.3 → 0.3.4
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 +4 -4
- data/fluent-plugin-mqtt-io.gemspec +1 -1
- data/lib/fluent/plugin/in_mqtt.rb +5 -6
- data/lib/fluent/plugin/mqtt_proxy.rb +11 -9
- data/lib/fluent/plugin/out_mqtt.rb +7 -0
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 37e8d6d8654a36f64c79820fbad23be5ae0ddebb
|
|
4
|
+
data.tar.gz: e9948422c7a870dcc6fae0d823ffb11c7c57015e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 374d8bdcd8ac17ef363f68808211948071d8b8eaedb9e0c0d93ad878a44d358793b9ae95512bcf1ed64bf1acb421fb70740428c39ca66127383b9aad09a2bb45
|
|
7
|
+
data.tar.gz: 2b0d5bddcf1184ffeeb1f630cd0c1caf5688d37b17187dd320d9104d03aa2b998b047dc5c1a1e45378d334120f327ea323e15a515c55536b5540a4e4c9bfa42d
|
|
@@ -9,7 +9,7 @@ module Fluent::Plugin
|
|
|
9
9
|
|
|
10
10
|
Fluent::Plugin.register_input('mqtt', self)
|
|
11
11
|
|
|
12
|
-
helpers :
|
|
12
|
+
helpers :compat_parameters, :parser
|
|
13
13
|
|
|
14
14
|
desc 'The topic to subscribe.'
|
|
15
15
|
config_param :topic, :string, default: '#'
|
|
@@ -59,14 +59,13 @@ module Fluent::Plugin
|
|
|
59
59
|
def after_connection
|
|
60
60
|
if @client.connected?
|
|
61
61
|
@client.subscribe(@topic)
|
|
62
|
-
thread_create(:in_mqtt_get) do
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
emit(topic, message)
|
|
66
|
-
end
|
|
62
|
+
@get_thread = thread_create(:in_mqtt_get) do
|
|
63
|
+
@client.get do |topic, message|
|
|
64
|
+
emit(topic, message)
|
|
67
65
|
end
|
|
68
66
|
end
|
|
69
67
|
end
|
|
68
|
+
@get_thread
|
|
70
69
|
end
|
|
71
70
|
|
|
72
71
|
def add_recv_time(record)
|
|
@@ -4,7 +4,7 @@ module Fluent::Plugin
|
|
|
4
4
|
MQTT_PORT = 1883
|
|
5
5
|
|
|
6
6
|
def self.included(base)
|
|
7
|
-
base.helpers :timer
|
|
7
|
+
base.helpers :timer, :thread
|
|
8
8
|
|
|
9
9
|
base.desc 'The address to connect to.'
|
|
10
10
|
base.config_param :host, :string, default: '127.0.0.1'
|
|
@@ -63,7 +63,6 @@ module Fluent::Plugin
|
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
init_retry_interval
|
|
66
|
-
@client_mutex = Mutex.new
|
|
67
66
|
@client = MQTT::Client.new(opts)
|
|
68
67
|
connect
|
|
69
68
|
end
|
|
@@ -113,17 +112,20 @@ module Fluent::Plugin
|
|
|
113
112
|
|
|
114
113
|
def after_connection
|
|
115
114
|
# should be implemented
|
|
115
|
+
# returns thread instance for monitor thread to wait
|
|
116
|
+
# for Exception raised by MQTT I/O
|
|
116
117
|
end
|
|
117
118
|
|
|
118
119
|
def connect
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
120
|
+
thread_create("#{current_plugin_name}_monitor".to_sym) do
|
|
121
|
+
rescue_disconnection do
|
|
122
|
+
@client.connect
|
|
123
|
+
log.debug "connected to mqtt broker #{@host}:#{@port} for #{current_plugin_name}"
|
|
124
|
+
init_retry_interval
|
|
125
|
+
thread = after_connection
|
|
126
|
+
thread.join
|
|
127
|
+
end
|
|
124
128
|
end
|
|
125
|
-
@client_mutex.unlock
|
|
126
|
-
after_connection
|
|
127
129
|
end
|
|
128
130
|
end
|
|
129
131
|
end
|