@Tags(value={"kafka","record","sink"}) @CapabilityDescription(value="Provides a service to write records to a Kafka 1.x topic.") public class KafkaRecordSink_1_0 extends AbstractControllerService implements RecordSinkService
| Modifier and Type | Class and Description |
|---|---|
private static class |
KafkaRecordSink_1_0.KafkaSendException |
| Modifier and Type | Field and Description |
|---|---|
(package private) static PropertyDescriptor |
ACK_WAIT_TIME |
(package private) static PropertyDescriptor |
COMPRESSION_CODEC |
(package private) static AllowableValue |
DELIVERY_BEST_EFFORT |
(package private) static PropertyDescriptor |
DELIVERY_GUARANTEE |
(package private) static AllowableValue |
DELIVERY_ONE_NODE |
(package private) static AllowableValue |
DELIVERY_REPLICATED |
(package private) static AllowableValue |
HEX_ENCODING |
(package private) static PropertyDescriptor |
MAX_REQUEST_SIZE |
private long |
maxAckWaitMillis |
private int |
maxMessageSize |
(package private) static PropertyDescriptor |
MESSAGE_HEADER_ENCODING |
(package private) static PropertyDescriptor |
METADATA_WAIT_TIME |
private org.apache.kafka.clients.producer.Producer<byte[],byte[]> |
producer |
private List<PropertyDescriptor> |
properties |
private String |
topic |
(package private) static PropertyDescriptor |
TOPIC |
(package private) static AllowableValue |
UTF8_ENCODING |
private RecordSetWriterFactory |
writerFactory |
RECORD_WRITER_FACTORY| Constructor and Description |
|---|
KafkaRecordSink_1_0() |
| Modifier and Type | Method and Description |
|---|---|
(package private) static void |
buildCommonKafkaProperties(ConfigurationContext context,
Class<?> kafkaConfigClass,
Map<String,Object> mapToPopulate) |
protected org.apache.kafka.clients.producer.Producer<byte[],byte[]> |
createProducer(Map<String,Object> kafkaProperties) |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
protected RecordSetWriterFactory |
getWriterFactory() |
protected void |
init(ControllerServiceInitializationContext context) |
void |
onEnabled(ConfigurationContext context) |
WriteResult |
sendData(RecordSet recordSet,
Map<String,String> attributes,
boolean sendZeroResults) |
private static void |
setJaasConfig(Map<String,Object> mapToPopulate,
ConfigurationContext context)
Method used to configure the 'sasl.jaas.config' property based on KAFKA-4259
https://cwiki.apache.org/confluence/display/KAFKA/KIP-85%3A+Dynamic+JAAS+configuration+for+Kafka+clients It expects something with the following format: <LoginModuleClass> <ControlFlag> *(<OptionName>=<OptionValue>); ControlFlag = required / requisite / sufficient / optional |
void |
stop() |
abstractClearConfigContext, abstractStoreConfigContext, disabled, enabled, getConfigurationContext, getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, getProperty, getStateManager, initialize, isEnabledequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, toString, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitresetinitialize, isStatefulgetIdentifier, getPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validatestatic final AllowableValue DELIVERY_REPLICATED
static final AllowableValue DELIVERY_ONE_NODE
static final AllowableValue DELIVERY_BEST_EFFORT
static final AllowableValue UTF8_ENCODING
static final AllowableValue HEX_ENCODING
static final PropertyDescriptor TOPIC
static final PropertyDescriptor DELIVERY_GUARANTEE
static final PropertyDescriptor METADATA_WAIT_TIME
static final PropertyDescriptor ACK_WAIT_TIME
static final PropertyDescriptor MAX_REQUEST_SIZE
static final PropertyDescriptor COMPRESSION_CODEC
static final PropertyDescriptor MESSAGE_HEADER_ENCODING
private List<PropertyDescriptor> properties
private volatile RecordSetWriterFactory writerFactory
private volatile int maxMessageSize
private volatile long maxAckWaitMillis
private volatile String topic
private volatile org.apache.kafka.clients.producer.Producer<byte[],byte[]> producer
protected void init(ControllerServiceInitializationContext context) throws InitializationException
init in class AbstractControllerServiceInitializationExceptionprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponent@OnEnabled public void onEnabled(ConfigurationContext context) throws InitializationException
InitializationExceptionpublic WriteResult sendData(RecordSet recordSet, Map<String,String> attributes, boolean sendZeroResults) throws IOException
sendData in interface RecordSinkServiceIOException@OnDisabled public void stop() throws IOException
IOExceptionstatic void buildCommonKafkaProperties(ConfigurationContext context, Class<?> kafkaConfigClass, Map<String,Object> mapToPopulate)
private static void setJaasConfig(Map<String,Object> mapToPopulate, ConfigurationContext context)
mapToPopulate - Map of configuration propertiescontext - Contextprotected RecordSetWriterFactory getWriterFactory()
Copyright © 2022 Apache NiFi Project. All rights reserved.