@Tags(value={"Apache","Kafka","Record","csv","json","avro","logs","Put","Send","Message","PubSub","1.0"}) @CapabilityDescription(value="Sends the contents of a FlowFile as individual records to Apache Kafka using the Kafka 1.0 Producer API. The contents of the FlowFile are expected to be record-oriented data that can be read by the configured Record Reader. The complementary NiFi processor for fetching messages is ConsumeKafkaRecord_1_0.") @InputRequirement(value=INPUT_REQUIRED) @DynamicProperty(name="The name of a Kafka configuration property.", value="The value of a given Kafka configuration property.", description="These properties will be added on the Kafka configuration after loading any provided configuration properties. In the event a dynamic property represents a property that was already set, its value will be ignored and WARN message logged. For the list of available Kafka properties please refer to: http://kafka.apache.org/documentation.html#configuration. ", expressionLanguageScope=VARIABLE_REGISTRY) @WritesAttribute(attribute="msg.count", description="The number of messages that were sent to Kafka for this FlowFile. This attribute is added only to FlowFiles that are routed to success.") @SeeAlso(value={PublishKafka_1_0.class,ConsumeKafka_1_0.class,ConsumeKafkaRecord_1_0.class}) public class PublishKafkaRecord_1_0 extends AbstractProcessor
| Constructor and Description |
|---|
PublishKafkaRecord_1_0() |
| Modifier and Type | Method and Description |
|---|---|
void |
closePool() |
protected PublisherPool |
createPublisherPool(ProcessContext context) |
protected Collection<ValidationResult> |
customValidate(ValidationContext validationContext) |
private Integer |
evaluateRecordPath(RecordPath recordPath,
Record record) |
private Function<Record,Integer> |
getPartitioner(ProcessContext context,
FlowFile flowFile) |
private PublisherPool |
getPublisherPool(ProcessContext context) |
Set<Relationship> |
getRelationships() |
protected PropertyDescriptor |
getSupportedDynamicPropertyDescriptor(String propertyDescriptorName) |
protected List<PropertyDescriptor> |
getSupportedPropertyDescriptors() |
void |
onTrigger(ProcessContext context,
ProcessSession session) |
onTriggergetControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueequals, getPropertyDescriptor, getPropertyDescriptors, hashCode, onPropertyModified, validateclone, finalize, getClass, notify, notifyAll, wait, wait, waitisStatefulgetPropertyDescriptor, getPropertyDescriptors, onPropertyModified, validateprotected static final String MSG_COUNT
static final AllowableValue DELIVERY_REPLICATED
static final AllowableValue DELIVERY_ONE_NODE
static final AllowableValue DELIVERY_BEST_EFFORT
static final AllowableValue ROUND_ROBIN_PARTITIONING
static final AllowableValue RANDOM_PARTITIONING
static final AllowableValue RECORD_PATH_PARTITIONING
static final AllowableValue EXPRESSION_LANGUAGE_PARTITIONING
static final AllowableValue UTF8_ENCODING
static final AllowableValue HEX_ENCODING
static final PropertyDescriptor TOPIC
static final PropertyDescriptor RECORD_READER
static final PropertyDescriptor RECORD_WRITER
static final PropertyDescriptor MESSAGE_KEY_FIELD
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 PARTITION_CLASS
static final PropertyDescriptor PARTITION
static final PropertyDescriptor COMPRESSION_CODEC
static final PropertyDescriptor ATTRIBUTE_NAME_REGEX
static final PropertyDescriptor USE_TRANSACTIONS
static final PropertyDescriptor TRANSACTIONAL_ID_PREFIX
static final PropertyDescriptor MESSAGE_HEADER_ENCODING
static final Relationship REL_SUCCESS
static final Relationship REL_FAILURE
private static final List<PropertyDescriptor> PROPERTIES
private static final Set<Relationship> RELATIONSHIPS
private volatile PublisherPool publisherPool
private final RecordPathCache recordPathCache
public Set<Relationship> getRelationships()
getRelationships in interface ProcessorgetRelationships in class AbstractSessionFactoryProcessorprotected List<PropertyDescriptor> getSupportedPropertyDescriptors()
getSupportedPropertyDescriptors in class AbstractConfigurableComponentprotected PropertyDescriptor getSupportedDynamicPropertyDescriptor(String propertyDescriptorName)
getSupportedDynamicPropertyDescriptor in class AbstractConfigurableComponentprotected Collection<ValidationResult> customValidate(ValidationContext validationContext)
customValidate in class AbstractConfigurableComponentprivate PublisherPool getPublisherPool(ProcessContext context)
protected PublisherPool createPublisherPool(ProcessContext context)
@OnStopped public void closePool()
public void onTrigger(ProcessContext context, ProcessSession session) throws ProcessException
onTrigger in class AbstractProcessorProcessExceptionprivate Function<Record,Integer> getPartitioner(ProcessContext context, FlowFile flowFile)
private Integer evaluateRecordPath(RecordPath recordPath, Record record)
Copyright © 2022 Apache NiFi Project. All rights reserved.