Github user minifirocks commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/228#discussion_r159806371
--- Diff: extensions/mqtt/AbstractMQTTProcessor.h ---
@@ -0,0 +1,154 @@
+/**
+ * @file AbstractMQTTProcessor.h
+ * AbstractMQTTProcessor class declaration
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#ifndef __ABSTRACTMQTT_H__
+#define __ABSTRACTMQTT_H__
+
+#include "FlowFileRecord.h"
+#include "core/Processor.h"
+#include "core/ProcessSession.h"
+#include "core/Core.h"
+#include "core/Resource.h"
+#include "core/logging/LoggerConfiguration.h"
+#include "MQTTClient.h"
+
+#define MQTT_QOS_0 "0"
+#define MQTT_QOS_1 "1"
+#define MQTT_QOS_2 "2"
+
+namespace org {
+namespace apache {
+namespace nifi {
+namespace minifi {
+namespace processors {
+
+// AbstractMQTTProcessor Class
+class AbstractMQTTProcessor : public core::Processor {
+ public:
+ // Constructor
+ /*!
+ * Create a new processor
+ */
+ explicit AbstractMQTTProcessor(std::string name, uuid_t uuid = NULL)
+ : core::Processor(name, uuid),
+
logger_(logging::LoggerFactory<AbstractMQTTProcessor>::getLogger()) {
+ client_ = nullptr;
+ cleanSession_ = false;
+ keepAliveInterval_ = 60;
+ connectionTimeOut_ = 30;
+ qos_ = 0;
+ isSubscriber_ = false;
+ }
+ // Destructor
+ virtual ~AbstractMQTTProcessor() {
+ if (isSubscriber_) {
+ MQTTClient_unsubscribe(client_, topic_.c_str());
--- End diff --
it should be. only side effect is if app halt and did not unsub. The broker
will buffer the msgs to the topic while the client is go away. if the app
restart with the same topic and same client ID, it will rx all msg buffer for
that client buffered in the broker.
---