Class DefaultServiceBusNamespaceProcessorFactory
java.lang.Object
com.azure.spring.messaging.servicebus.core.DefaultServiceBusNamespaceProcessorFactory
- All Implemented Interfaces:
ServiceBusProcessorFactory,org.springframework.beans.factory.DisposableBean
public final class DefaultServiceBusNamespaceProcessorFactory
extends Object
implements ServiceBusProcessorFactory, org.springframework.beans.factory.DisposableBean
The
ServiceBusProcessorFactory implementation to produce new ServiceBusProcessorClient instances
for provided NamespaceProperties and optional
processor PropertiesSupplier on each createProcessor(java.lang.String, com.azure.spring.cloud.service.listener.MessageListener<?>, com.azure.spring.cloud.service.servicebus.consumer.ServiceBusErrorHandler) invocation.
ServiceBusProcessorClient 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.servicebus.core.ServiceBusProcessorFactory
ServiceBusProcessorFactory.Listener -
Constructor Summary
ConstructorsConstructorDescriptionDefaultServiceBusNamespaceProcessorFactory(NamespaceProperties namespaceProperties) Construct a factory with the provided namespace level properties.DefaultServiceBusNamespaceProcessorFactory(NamespaceProperties namespaceProperties, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the provided namespace level properties and processorPropertiesSupplier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusProcessorClientBuildercustomizer to customize all the non-session clients created from this factory.voidaddBuilderCustomizer(String entityName, String subscription, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with entity name of valueentityNameand subscription of valuesubscription.voidAdd a listener for this factory.voidaddSessionBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusSessionProcessorClientBuildercustomizer to customize all the session clients created from this factory.voidaddSessionBuilderCustomizer(String entityName, String subscription, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with entity name of valueentityNameand subscription of valuesubscription.com.azure.messaging.servicebus.ServiceBusProcessorClientcreateProcessor(String queue, com.azure.spring.cloud.service.listener.MessageListener<?> messageListener, com.azure.spring.cloud.service.servicebus.consumer.ServiceBusErrorHandler errorHandler) Create aServiceBusProcessorClientto consume events from the specified queue.com.azure.messaging.servicebus.ServiceBusProcessorClientcreateProcessor(String queue, ServiceBusContainerProperties containerProperties) Create aServiceBusProcessorClientto consume events from the specified queue.com.azure.messaging.servicebus.ServiceBusProcessorClientcreateProcessor(String topic, String subscription, com.azure.spring.cloud.service.listener.MessageListener<?> messageListener, com.azure.spring.cloud.service.servicebus.consumer.ServiceBusErrorHandler errorHandler) Create aServiceBusProcessorClientto consume events from the specified topic in the context of the given subscription.com.azure.messaging.servicebus.ServiceBusProcessorClientcreateProcessor(String topic, String subscription, ServiceBusContainerProperties containerProperties) Create aServiceBusProcessorClientto consume events from the specified topic in the context of the given subscription.voiddestroy()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.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.spring.messaging.servicebus.core.ServiceBusProcessorFactory
removeListener
-
Constructor Details
-
DefaultServiceBusNamespaceProcessorFactory
Construct a factory with the provided namespace level properties.- Parameters:
namespaceProperties- the namespace properties.
-
DefaultServiceBusNamespaceProcessorFactory
public DefaultServiceBusNamespaceProcessorFactory(NamespaceProperties namespaceProperties, PropertiesSupplier<ConsumerIdentifier, ProcessorProperties> supplier) Construct a factory with the provided namespace level properties and processorPropertiesSupplier.- Parameters:
namespaceProperties- the namespace properties.supplier- thePropertiesSupplierto supplyProcessorPropertiesfor each queue/topic entity.
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
createProcessor
public com.azure.messaging.servicebus.ServiceBusProcessorClient createProcessor(String queue, com.azure.spring.cloud.service.listener.MessageListener<?> messageListener, com.azure.spring.cloud.service.servicebus.consumer.ServiceBusErrorHandler errorHandler) Description copied from interface:ServiceBusProcessorFactoryCreate aServiceBusProcessorClientto consume events from the specified queue.- Specified by:
createProcessorin interfaceServiceBusProcessorFactory- Parameters:
queue- The queue name.messageListener- message listener to be registered on service bus processor client.errorHandler- the error handler to consume the errors.- Returns:
- ServiceBusProcessorClient queue processor client.
-
createProcessor
public com.azure.messaging.servicebus.ServiceBusProcessorClient createProcessor(String queue, ServiceBusContainerProperties containerProperties) Description copied from interface:ServiceBusProcessorFactoryCreate aServiceBusProcessorClientto consume events from the specified queue.- Specified by:
createProcessorin interfaceServiceBusProcessorFactory- Parameters:
queue- The queue name.containerProperties- theServiceBusContainerPropertiesto describe the processor.- Returns:
- the queue processor client.
-
createProcessor
public com.azure.messaging.servicebus.ServiceBusProcessorClient createProcessor(String topic, String subscription, com.azure.spring.cloud.service.listener.MessageListener<?> messageListener, com.azure.spring.cloud.service.servicebus.consumer.ServiceBusErrorHandler errorHandler) Description copied from interface:ServiceBusProcessorFactoryCreate aServiceBusProcessorClientto consume events from the specified topic in the context of the given subscription.- Specified by:
createProcessorin interfaceServiceBusProcessorFactory- Parameters:
topic- The topic.subscription- The subscription.messageListener- message listener to be registered on service bus processor client.errorHandler- the error handler to consume the errors.- Returns:
- the topic processor client.
-
createProcessor
public com.azure.messaging.servicebus.ServiceBusProcessorClient createProcessor(String topic, String subscription, ServiceBusContainerProperties containerProperties) Description copied from interface:ServiceBusProcessorFactoryCreate aServiceBusProcessorClientto consume events from the specified topic in the context of the given subscription.- Specified by:
createProcessorin interfaceServiceBusProcessorFactory- Parameters:
topic- The topic.subscription- The subscription.containerProperties- theServiceBusContainerPropertiesto describe the processor.- Returns:
- the topic processor client.
-
addListener
Description copied from interface:ServiceBusProcessorFactoryAdd a listener for this factory.- Specified by:
addListenerin interfaceServiceBusProcessorFactory- Parameters:
listener- the listener.
-
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.servicebus.ServiceBusClientBuilder.ServiceBusProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusProcessorClientBuildercustomizer to customize all the non-session clients created from this factory.- Parameters:
customizer- the provided builder customizer.
-
addSessionBuilderCustomizer
public void addSessionBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusSessionProcessorClientBuildercustomizer to customize all the session clients created from this factory.- Parameters:
customizer- the provided builder customizer.
-
addBuilderCustomizer
public void addBuilderCustomizer(String entityName, String subscription, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with entity name of valueentityNameand subscription of valuesubscription.- Parameters:
entityName- the entity name, could either be the queue name or topic name.subscription- the subscription name of the topic, could be null if it is a queue.customizer- the provided customizer.
-
addSessionBuilderCustomizer
public void addSessionBuilderCustomizer(String entityName, String subscription, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with entity name of valueentityNameand subscription of valuesubscription.- Parameters:
entityName- the entity name, could either be the queue name or topic name.subscription- the subscription name of the topic, could be null if it is a queue.customizer- the provided customizer.
-