hunyadi-dev commented on a change in pull request #940: URL: https://github.com/apache/nifi-minifi-cpp/pull/940#discussion_r577491948
########## File path: extensions/librdkafka/ConsumeKafka.h ########## @@ -0,0 +1,181 @@ +/** + * 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. + */ + +#pragma once + +#include <memory> +#include <string> +#include <utility> +#include <vector> + +#include "core/Processor.h" +#include "core/logging/LoggerConfiguration.h" +#include "rdkafka.h" +#include "rdkafka_utils.h" +#include "KafkaConnection.h" + +namespace org { +namespace apache { +namespace nifi { +namespace minifi { +namespace processors { + +class ConsumeKafka : public core::Processor { + public: + static constexpr char const* ProcessorName = "ConsumeKafka"; + + // Supported Properties + static core::Property KafkaBrokers; + static core::Property SecurityProtocol; + static core::Property TopicNames; + static core::Property TopicNameFormat; + static core::Property HonorTransactions; + static core::Property GroupID; + static core::Property OffsetReset; + static core::Property KeyAttributeEncoding; + static core::Property MessageDemarcator; + static core::Property MessageHeaderEncoding; + static core::Property HeadersToAddAsAttributes; + static core::Property DuplicateHeaderHandling; + static core::Property MaxPollRecords; + static core::Property MaxPollTime; + static core::Property SessionTimeout; + + // Supported Relationships + static const core::Relationship Success; + + // Security Protocol allowable values + static constexpr char const* SECURITY_PROTOCOL_PLAINTEXT = "PLAINTEXT"; + static constexpr char const* SECURITY_PROTOCOL_SSL = "SSL"; + static constexpr char const* SECURITY_PROTOCOL_SASL_PLAINTEXT = "SASL_PLAINTEXT"; + static constexpr char const* SECURITY_PROTOCOL_SASL_SSL = "SASL_SSL"; + + // Topic Name Format allowable values + static constexpr char const* TOPIC_FORMAT_NAMES = "Names"; + static constexpr char const* TOPIC_FORMAT_PATTERNS = "Patterns"; + + // Offset Reset allowable values + static constexpr char const* OFFSET_RESET_EARLIEST = "earliest"; + static constexpr char const* OFFSET_RESET_LATEST = "latest"; + static constexpr char const* OFFSET_RESET_NONE = "none"; + + // Key Attribute Encoding allowable values + static constexpr char const* KEY_ATTR_ENCODING_UTF_8 = "UTF-8"; + static constexpr char const* KEY_ATTR_ENCODING_HEX = "Hex"; + + // Message Header Encoding allowable values + static constexpr char const* MSG_HEADER_ENCODING_UTF_8 = "UTF-8"; + static constexpr char const* MSG_HEADER_ENCODING_HEX = "Hex"; + + // Duplicate Header Handling allowable values + static constexpr char const* MSG_HEADER_KEEP_FIRST = "Keep First"; + static constexpr char const* MSG_HEADER_KEEP_LATEST = "Keep Latest"; + static constexpr char const* MSG_HEADER_COMMA_SEPARATED_MERGE = "Comma-separated Merge"; + + // Flowfile attributes written + static constexpr char const* KAFKA_COUNT_ATTR = "kafka.count"; // Always 1 until we start supporting merging from batches + static constexpr char const* KAFKA_MESSAGE_KEY_ATTR = "kafka.key"; + static constexpr char const* KAFKA_OFFSET_ATTR = "kafka.offset"; + static constexpr char const* KAFKA_PARTITION_ATTR = "kafka.partition"; + static constexpr char const* KAFKA_TOPIC_ATTR = "kafka.topic"; + + static constexpr const std::size_t DEFAULT_MAX_POLL_RECORDS{ 10000 }; + static constexpr char const* DEFAULT_MAX_POLL_TIME = "4 seconds"; + static constexpr const std::size_t METADATA_COMMUNICATIONS_TIMEOUT_MS{ 60000 }; + + explicit ConsumeKafka(std::string name, utils::Identifier uuid = utils::Identifier()) : Review comment: Agreed, I did not even notice it when copy-pasting another processor. Maybe we should consider updating all occurences of this usage?  ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
