blob: 6879de20e0f22d64940fda8c4fb904d66f52f367 [file] [log] [blame]
/**
* @file KafkaProcessorBase.h
* KafkaProcessorBase 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.
*/
#pragma once
#include <optional>
#include <memory>
#include <string>
#include "core/Processor.h"
#include "rdkafka_utils.h"
#include "utils/Enum.h"
namespace org::apache::nifi::minifi::processors {
// PublishKafka Class
class KafkaProcessorBase : public core::Processor {
public:
EXTENSIONAPI static const core::Property SSLContextService;
EXTENSIONAPI static const core::Property SecurityProtocol;
EXTENSIONAPI static const core::Property KerberosServiceName;
EXTENSIONAPI static const core::Property KerberosPrincipal;
EXTENSIONAPI static const core::Property KerberosKeytabPath;
EXTENSIONAPI static const core::Property SASLMechanism;
EXTENSIONAPI static const core::Property Username;
EXTENSIONAPI static const core::Property Password;
SMART_ENUM(SecurityProtocolOption,
(PLAINTEXT, "plaintext"),
(SSL, "ssl"),
(SASL_PLAIN, "sasl_plaintext"),
(SASL_SSL, "sasl_ssl")
)
SMART_ENUM(SASLMechanismOption,
(GSSAPI, "GSSAPI"),
(PLAIN, "PLAIN")
)
KafkaProcessorBase(const std::string& name, const utils::Identifier& uuid, std::shared_ptr<core::logging::Logger> logger)
: core::Processor(name, uuid),
logger_(logger) {
}
protected:
virtual std::optional<utils::SSL_data> getSslData(core::ProcessContext& context) const;
void setKafkaAuthenticationParameters(core::ProcessContext& context, gsl::not_null<rd_kafka_conf_t*> config);
SecurityProtocolOption security_protocol_;
std::shared_ptr<core::logging::Logger> logger_;
};
} // namespace org::apache::nifi::minifi::processors