Class DefaultEventHubsNamespaceProcessorFactory
java.lang.Object
com.azure.spring.messaging.eventhubs.core.DefaultEventHubsNamespaceProcessorFactory
- All Implemented Interfaces:
EventHubsProcessorFactory,org.springframework.beans.factory.DisposableBean
public final class DefaultEventHubsNamespaceProcessorFactory
extends Object
implements EventHubsProcessorFactory, org.springframework.beans.factory.DisposableBean
The
EventHubsProcessorFactory implementation to produce new EventProcessorClient instances
for provided CheckpointStore checkpointStore and optional NamespaceProperties and
processor PropertiesSupplier on each createProcessor(java.lang.String, java.lang.String, com.azure.spring.cloud.service.listener.MessageListener<?>, com.azure.spring.cloud.service.eventhubs.consumer.EventHubsErrorHandler) invocation.
The created EventProcessorClients are cached according to the event hub names and consumer groups.
EventProcessorClient produced by this factory will share the same namespace level configuration, but if a
configuration entry is provided at both processor and namespace level, the processor level configuration will take
advantage.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.azure.spring.messaging.eventhubs.core.EventHubsProcessorFactory
EventHubsProcessorFactory.Listener -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore) Construct a factory with the providedCheckpointStore.DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, NamespaceProperties namespaceProperties) Construct a factory with the providedCheckpointStoreand namespace level properties.DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, NamespaceProperties namespaceProperties, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the providedCheckpointStore, namespace level properties and processorPropertiesSupplier.DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the providedCheckpointStoreand processorPropertiesSupplier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.eventhubs.EventProcessorClientBuilder> customizer) Add a service client builder customizer to customize all the clients created from this factory.voidaddBuilderCustomizer(String eventHub, String consumerGroup, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.eventhubs.EventProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with event hub name of valueeventHuband consumer group of valueconsumerGroup.voidAdd a listener for this factory.com.azure.messaging.eventhubs.EventProcessorClientcreateProcessor(String eventHub, String consumerGroup, com.azure.spring.cloud.service.listener.MessageListener<?> listener, com.azure.spring.cloud.service.eventhubs.consumer.EventHubsErrorHandler errorHandler) Create anEventProcessorClientto consume events from the specified event hub in the context of the given consumer group.com.azure.messaging.eventhubs.EventProcessorClientcreateProcessor(String eventHub, String consumerGroup, EventHubsContainerProperties containerProperties) Create anEventProcessorClientto consume events from the specified event hub in the context of the given consumer group.voiddestroy()booleanRemove a listener from this factory.voidsetDefaultCredential(com.azure.core.credential.TokenCredential defaultCredential) Set the default credential for all clients generated from this factory.voidsetTokenCredentialResolver(com.azure.spring.cloud.core.credential.AzureCredentialResolver<com.azure.core.credential.TokenCredential> tokenCredentialResolver) Set the token credential resolver.
-
Constructor Details
-
DefaultEventHubsNamespaceProcessorFactory
public DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore) Construct a factory with the providedCheckpointStore.- Parameters:
checkpointStore- the checkpoint store.
-
DefaultEventHubsNamespaceProcessorFactory
public DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, NamespaceProperties namespaceProperties) Construct a factory with the providedCheckpointStoreand namespace level properties.- Parameters:
checkpointStore- the checkpoint store.namespaceProperties- the namespace properties.
-
DefaultEventHubsNamespaceProcessorFactory
public DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the providedCheckpointStoreand processorPropertiesSupplier.- Parameters:
checkpointStore- the checkpoint store.supplier- thePropertiesSupplierto supplyProcessorPropertiesfor each event hub.
-
DefaultEventHubsNamespaceProcessorFactory
public DefaultEventHubsNamespaceProcessorFactory(com.azure.messaging.eventhubs.CheckpointStore checkpointStore, NamespaceProperties namespaceProperties, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the providedCheckpointStore, namespace level properties and processorPropertiesSupplier.- Parameters:
checkpointStore- the checkpoint store.namespaceProperties- the namespace properties.supplier- thePropertiesSupplierto supplyProcessorPropertiesfor each event hub.
-
-
Method Details
-
createProcessor
public com.azure.messaging.eventhubs.EventProcessorClient createProcessor(@NonNull String eventHub, @NonNull String consumerGroup, @NonNull com.azure.spring.cloud.service.listener.MessageListener<?> listener, @NonNull com.azure.spring.cloud.service.eventhubs.consumer.EventHubsErrorHandler errorHandler) Description copied from interface:EventHubsProcessorFactoryCreate anEventProcessorClientto consume events from the specified event hub in the context of the given consumer group.- Specified by:
createProcessorin interfaceEventHubsProcessorFactory- Parameters:
eventHub- the event hub to consume events from.consumerGroup- the consumer group.listener- theMessageListenerto consume events with.errorHandler- the error handler to handle the errors.- Returns:
- the processor client.
-
createProcessor
public com.azure.messaging.eventhubs.EventProcessorClient createProcessor(String eventHub, String consumerGroup, EventHubsContainerProperties containerProperties) Description copied from interface:EventHubsProcessorFactoryCreate anEventProcessorClientto consume events from the specified event hub in the context of the given consumer group.- Specified by:
createProcessorin interfaceEventHubsProcessorFactory- Parameters:
eventHub- the event hub to consume events from.consumerGroup- the consumer group.containerProperties- theEventHubsContainerPropertiesto describe the processor.- Returns:
- the processor client.
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
addListener
Description copied from interface:EventHubsProcessorFactoryAdd a listener for this factory.- Specified by:
addListenerin interfaceEventHubsProcessorFactory- Parameters:
listener- the listener.
-
removeListener
Description copied from interface:EventHubsProcessorFactoryRemove a listener from this factory.- Specified by:
removeListenerin interfaceEventHubsProcessorFactory- Parameters:
listener- the listener.- Returns:
- true if removed.
-
setTokenCredentialResolver
public void setTokenCredentialResolver(com.azure.spring.cloud.core.credential.AzureCredentialResolver<com.azure.core.credential.TokenCredential> tokenCredentialResolver) Set the token credential resolver.- Parameters:
tokenCredentialResolver- The token credential resolver.
-
setDefaultCredential
public void setDefaultCredential(com.azure.core.credential.TokenCredential defaultCredential) Set the default credential for all clients generated from this factory.- Parameters:
defaultCredential- The default credential.
-
addBuilderCustomizer
public void addBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.eventhubs.EventProcessorClientBuilder> customizer) Add a service client builder customizer to customize all the clients created from this factory.- Parameters:
customizer- the provided customizer.
-
addBuilderCustomizer
public void addBuilderCustomizer(String eventHub, String consumerGroup, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.eventhubs.EventProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with event hub name of valueeventHuband consumer group of valueconsumerGroup.- Parameters:
eventHub- the event hub name of the client.consumerGroup- the consumer group of the client.customizer- the provided customizer.
-