Class ConsumeAzureEventHub
java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processors.azure.eventhub.ConsumeAzureEventHub
- All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent,org.apache.nifi.processor.Processor,AzureEventHubComponent
@Tags({"azure","microsoft","cloud","eventhub","events","streaming","streams"})
@CapabilityDescription("Receives messages from Microsoft Azure Event Hubs with checkpointing to ensure consistent event processing. Checkpoint tracking avoids consuming a message multiple times and enables reliable resumption of processing in the event of intermittent network failures. Checkpoint tracking requires external storage and provides the preferred approach to consuming messages from Azure Event Hubs. In clustered environment, ConsumeAzureEventHub processor instances form a consumer group and the messages are distributed among the cluster nodes (each message is processed on one cluster node only).")
@InputRequirement(INPUT_FORBIDDEN)
@Stateful(scopes={LOCAL,CLUSTER},
description="Local state is used to store the client id. Cluster state is used to store partition ownership and checkpoint information when component state is configured as the checkpointing strategy.")
@TriggerSerially
@WritesAttribute(attribute="eventhub.enqueued.timestamp",description="The time (in milliseconds since epoch, UTC) at which the message was enqueued in the event hub") @WritesAttribute(attribute="eventhub.offset",description="The offset into the partition at which the message was stored") @WritesAttribute(attribute="eventhub.sequence",description="The sequence number associated with the message") @WritesAttribute(attribute="eventhub.name",description="The name of the event hub from which the message was pulled") @WritesAttribute(attribute="eventhub.partition",description="The name of the partition from which the message was pulled") @WritesAttribute(attribute="eventhub.property.*",description="The application properties of this message. IE: \'application\' would be \'eventhub.property.application\'")
public class ConsumeAzureEventHub
extends org.apache.nifi.processor.AbstractSessionFactoryProcessor
implements AzureEventHubComponent
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate String(package private) static final org.apache.nifi.components.PropertyDescriptorprivate final Consumer<com.azure.messaging.eventhubs.models.ErrorContext> (package private) static final org.apache.nifi.components.PropertyDescriptorprotected final Consumer<com.azure.messaging.eventhubs.models.EventBatchContext> private com.azure.messaging.eventhubs.EventProcessorClientprivate static final Stringprivate static final String(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.AllowableValue(package private) static final org.apache.nifi.components.AllowableValueprivate booleanprivate boolean(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate org.apache.nifi.processor.ProcessSessionFactoryprivate static final List<org.apache.nifi.components.PropertyDescriptor> private RecordReaderFactory(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate static final Set<org.apache.nifi.processor.Relationship> (package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.processor.Relationship(package private) static final org.apache.nifi.processor.Relationshipprivate static final Set<org.apache.nifi.processor.Relationship> private static final Pattern(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptor(package private) static final org.apache.nifi.components.PropertyDescriptorprivate RecordSetWriterFactoryFields inherited from interface org.apache.nifi.shared.azure.eventhubs.AzureEventHubComponent
PROXY_CONFIGURATION_SERVICE, PROXY_SPECS, TRANSPORT_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected com.azure.messaging.eventhubs.EventProcessorClientcreateClient(org.apache.nifi.processor.ProcessContext context) private StringcreateStorageConnectionString(org.apache.nifi.processor.ProcessContext context) protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) getLegacyPartitionEventPosition(com.azure.storage.blob.BlobContainerAsyncClient blobContainerAsyncClient, String consumerGroup) Set<org.apache.nifi.processor.Relationship> protected List<org.apache.nifi.components.PropertyDescriptor> protected StringgetTransitUri(com.azure.messaging.eventhubs.models.PartitionContext partitionContext) voidmigrateProperties(org.apache.nifi.migration.PropertyConfiguration config) voidonPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) voidonScheduled(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) private voidputEventHubAttributes(Map<String, String> attributes, com.azure.messaging.eventhubs.models.PartitionContext partitionContext, com.azure.messaging.eventhubs.EventData eventData, com.azure.messaging.eventhubs.models.LastEnqueuedEventProperties lastEnqueuedEventProperties) voidprivate voidtransferTo(org.apache.nifi.processor.Relationship relationship, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch, com.azure.messaging.eventhubs.models.PartitionContext partitionContext, org.apache.nifi.flowfile.FlowFile flowFile) private voidwriteFlowFiles(com.azure.messaging.eventhubs.models.EventBatchContext eventBatchContext, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch) private voidwriteRecords(com.azure.messaging.eventhubs.models.EventBatchContext eventBatchContext, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch) Methods inherited from class org.apache.nifi.processor.AbstractSessionFactoryProcessor
getControllerServiceLookup, getIdentifier, getLogger, getNodeTypeProvider, init, initialize, isConfigurationRestored, isScheduled, toString, updateConfiguredRestoredTrue, updateScheduledFalse, updateScheduledTrueMethods inherited from class org.apache.nifi.components.AbstractConfigurableComponent
equals, getPropertyDescriptor, getPropertyDescriptors, getSupportedDynamicPropertyDescriptor, hashCode, validateMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.components.ConfigurableComponent
getPropertyDescriptor, getPropertyDescriptors, validateMethods inherited from interface org.apache.nifi.processor.Processor
isStateful, migrateRelationships
-
Field Details
-
SAS_TOKEN_PATTERN
-
FORMAT_STORAGE_CONNECTION_STRING_FOR_ACCOUNT_KEY
- See Also:
-
FORMAT_STORAGE_CONNECTION_STRING_FOR_SAS_TOKEN
- See Also:
-
NAMESPACE
static final org.apache.nifi.components.PropertyDescriptor NAMESPACE -
EVENT_HUB_NAME
static final org.apache.nifi.components.PropertyDescriptor EVENT_HUB_NAME -
SERVICE_BUS_ENDPOINT
static final org.apache.nifi.components.PropertyDescriptor SERVICE_BUS_ENDPOINT -
ACCESS_POLICY_NAME
static final org.apache.nifi.components.PropertyDescriptor ACCESS_POLICY_NAME -
POLICY_PRIMARY_KEY
static final org.apache.nifi.components.PropertyDescriptor POLICY_PRIMARY_KEY -
USE_MANAGED_IDENTITY
static final org.apache.nifi.components.PropertyDescriptor USE_MANAGED_IDENTITY -
CONSUMER_GROUP
static final org.apache.nifi.components.PropertyDescriptor CONSUMER_GROUP -
RECORD_READER
static final org.apache.nifi.components.PropertyDescriptor RECORD_READER -
RECORD_WRITER
static final org.apache.nifi.components.PropertyDescriptor RECORD_WRITER -
INITIAL_OFFSET_START_OF_STREAM
static final org.apache.nifi.components.AllowableValue INITIAL_OFFSET_START_OF_STREAM -
INITIAL_OFFSET_END_OF_STREAM
static final org.apache.nifi.components.AllowableValue INITIAL_OFFSET_END_OF_STREAM -
INITIAL_OFFSET
static final org.apache.nifi.components.PropertyDescriptor INITIAL_OFFSET -
PREFETCH_COUNT
static final org.apache.nifi.components.PropertyDescriptor PREFETCH_COUNT -
BATCH_SIZE
static final org.apache.nifi.components.PropertyDescriptor BATCH_SIZE -
RECEIVE_TIMEOUT
static final org.apache.nifi.components.PropertyDescriptor RECEIVE_TIMEOUT -
CHECKPOINT_STRATEGY
static final org.apache.nifi.components.PropertyDescriptor CHECKPOINT_STRATEGY -
STORAGE_ACCOUNT_NAME
static final org.apache.nifi.components.PropertyDescriptor STORAGE_ACCOUNT_NAME -
STORAGE_ACCOUNT_KEY
static final org.apache.nifi.components.PropertyDescriptor STORAGE_ACCOUNT_KEY -
STORAGE_SAS_TOKEN
static final org.apache.nifi.components.PropertyDescriptor STORAGE_SAS_TOKEN -
STORAGE_CONTAINER_NAME
static final org.apache.nifi.components.PropertyDescriptor STORAGE_CONTAINER_NAME -
REL_SUCCESS
static final org.apache.nifi.processor.Relationship REL_SUCCESS -
REL_PARSE_FAILURE
static final org.apache.nifi.processor.Relationship REL_PARSE_FAILURE -
RELATIONSHIPS
-
RECORD_RELATIONSHIPS
-
PROPERTIES
-
processSessionFactory
private volatile org.apache.nifi.processor.ProcessSessionFactory processSessionFactory -
eventProcessorClient
private volatile com.azure.messaging.eventhubs.EventProcessorClient eventProcessorClient -
readerFactory
-
writerFactory
-
isRecordReaderSet
private volatile boolean isRecordReaderSet -
isRecordWriterSet
private volatile boolean isRecordWriterSet -
clientId
-
eventBatchProcessor
protected final Consumer<com.azure.messaging.eventhubs.models.EventBatchContext> eventBatchProcessor -
errorProcessor
-
-
Constructor Details
-
ConsumeAzureEventHub
public ConsumeAzureEventHub()
-
-
Method Details
-
getSupportedPropertyDescriptors
- Overrides:
getSupportedPropertyDescriptorsin classorg.apache.nifi.components.AbstractConfigurableComponent
-
getRelationships
- Specified by:
getRelationshipsin interfaceorg.apache.nifi.processor.Processor- Overrides:
getRelationshipsin classorg.apache.nifi.processor.AbstractSessionFactoryProcessor
-
migrateProperties
public void migrateProperties(org.apache.nifi.migration.PropertyConfiguration config) - Specified by:
migratePropertiesin interfaceorg.apache.nifi.processor.Processor
-
customValidate
protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext validationContext) - Overrides:
customValidatein classorg.apache.nifi.components.AbstractConfigurableComponent
-
onPropertyModified
public void onPropertyModified(org.apache.nifi.components.PropertyDescriptor descriptor, String oldValue, String newValue) - Specified by:
onPropertyModifiedin interfaceorg.apache.nifi.components.ConfigurableComponent- Overrides:
onPropertyModifiedin classorg.apache.nifi.components.AbstractConfigurableComponent
-
onScheduled
@OnScheduled public void onScheduled(org.apache.nifi.processor.ProcessContext context) throws IOException - Throws:
IOException
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) - Specified by:
onTriggerin interfaceorg.apache.nifi.processor.Processor
-
stopClient
@OnStopped public void stopClient() -
createClient
protected com.azure.messaging.eventhubs.EventProcessorClient createClient(org.apache.nifi.processor.ProcessContext context) -
getTransitUri
protected String getTransitUri(com.azure.messaging.eventhubs.models.PartitionContext partitionContext) -
putEventHubAttributes
-
writeFlowFiles
private void writeFlowFiles(com.azure.messaging.eventhubs.models.EventBatchContext eventBatchContext, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch) -
writeRecords
private void writeRecords(com.azure.messaging.eventhubs.models.EventBatchContext eventBatchContext, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch) throws IOException - Throws:
IOException
-
transferTo
private void transferTo(org.apache.nifi.processor.Relationship relationship, org.apache.nifi.processor.ProcessSession session, StopWatch stopWatch, com.azure.messaging.eventhubs.models.PartitionContext partitionContext, org.apache.nifi.flowfile.FlowFile flowFile) -
createStorageConnectionString
-
getLegacyPartitionEventPosition
-