Github user apiri commented on a diff in the pull request:

    https://github.com/apache/nifi-minifi-cpp/pull/321#discussion_r186477513
  
    --- Diff: extensions/mqtt/controllerservice/MQTTControllerService.h ---
    @@ -0,0 +1,342 @@
    +/**
    + *
    + * 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 LIBMINIFI_INCLUDE_CONTROLLERS_MQTTCONTEXTSERVICE_H_
    +#define LIBMINIFI_INCLUDE_CONTROLLERS_MQTTCONTEXTSERVICE_H_
    +
    +#include <openssl/err.h>
    +#include <openssl/ssl.h>
    +#include <iostream>
    +#include <memory>
    +#include "core/Resource.h"
    +#include "utils/StringUtils.h"
    +#include "io/validation.h"
    +#include "core/controller/ControllerService.h"
    +#include "core/logging/LoggerConfiguration.h"
    +#include "controllers/SSLContextService.h"
    +#include "concurrentqueue.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 controllers {
    +
    +class Message {
    + public:
    +  // empty constructor facilitates moves
    +  Message() {
    +  }
    +  explicit Message(const std::string &topic, void *data, size_t dataLen)
    +      : topic_(topic),
    +        data_((uint8_t*) data, ((uint8_t*)data + dataLen)) {
    +  }
    +  explicit Message(const Message &&other)
    +      : topic_(std::move(other.topic_)),
    +        data_(std::move(other.data_)) {
    +  }
    +  ~Message() {
    +  }
    +
    +  Message &operator=(const Message &&other) {
    +    topic_ = std::move(other.topic_);
    +    data_ = std::move(other.data_);
    +    return *this;
    +  }
    +  std::string topic_;
    +  std::vector<uint8_t> data_;
    +};
    +
    +/**
    + * MQTTContextService provides a controller service for MQTT connectivity.
    + *
    + */
    +class MQTTControllerService : public core::controller::ControllerService {
    + public:
    +  explicit MQTTControllerService(const std::string &name, const 
std::string &id)
    +      : ControllerService(name, id),
    +        initialized_(false),
    +        client_(nullptr),
    +        keepAliveInterval_(0),
    +        connectionTimeOut_(0),
    +        qos_(2),
    +        ssl_context_service_(nullptr),
    +        
logger_(logging::LoggerFactory<MQTTControllerService>::getLogger()) {
    +  }
    +
    +  explicit MQTTControllerService(const std::string &name, uuid_t uuid = 0)
    +      : ControllerService(name, uuid),
    +        initialized_(false),
    +        client_(nullptr),
    +        keepAliveInterval_(0),
    +        connectionTimeOut_(0),
    +        qos_(2),
    +        ssl_context_service_(nullptr),
    +        
logger_(logging::LoggerFactory<MQTTControllerService>::getLogger()) {
    +  }
    +
    +  explicit MQTTControllerService(const std::string &name, const 
std::shared_ptr<Configure> &configuration)
    +      : ControllerService(name, nullptr),
    +        initialized_(false),
    +        client_(nullptr),
    +        keepAliveInterval_(0),
    +        connectionTimeOut_(0),
    +        qos_(2),
    +        ssl_context_service_(nullptr),
    +        
logger_(logging::LoggerFactory<MQTTControllerService>::getLogger()) {
    +    setConfiguration(configuration);
    +    initialize();
    +  }
    +
    +  static core::Property BrokerURL;
    +  static core::Property ClientID;
    +  static core::Property UserName;
    +  static core::Property PassWord;
    --- End diff --
    
    super nitpicky, but this comes off odd, any reason for this camelcasing?


---

Reply via email to