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
ConstructorDescriptionDefaultServiceBusNamespaceProcessorFactory
(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 TypeMethodDescriptionvoid
addBuilderCustomizer
(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusProcessorClientBuilder
customizer to customize all the non-session clients created from this factory.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 valueentityName
and subscription of valuesubscription
.void
Add a listener for this factory.void
addSessionBuilderCustomizer
(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder> customizer) Add aServiceBusClientBuilder.ServiceBusSessionProcessorClientBuilder
customizer to customize all the session clients created from this factory.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 valueentityName
and subscription of valuesubscription
.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) Create aServiceBusProcessorClient
to consume events from the specified queue.com.azure.messaging.servicebus.ServiceBusProcessorClient
createProcessor
(String queue, ServiceBusContainerProperties containerProperties) Create aServiceBusProcessorClient
to consume events from the specified queue.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) Create aServiceBusProcessorClient
to consume events from the specified topic in the context of the given subscription.com.azure.messaging.servicebus.ServiceBusProcessorClient
createProcessor
(String topic, String subscription, ServiceBusContainerProperties containerProperties) Create aServiceBusProcessorClient
to consume events from the specified topic in the context of the given subscription.void
destroy()
void
setDefaultCredential
(com.azure.core.credential.TokenCredential defaultCredential) Set the default credential for all clients generated from this factory.void
setTokenCredentialResolver
(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, wait
Methods 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
- thePropertiesSupplier
to supplyProcessorProperties
for each queue/topic entity.
-
-
Method Details
-
destroy
public void destroy()- Specified by:
destroy
in 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:ServiceBusProcessorFactory
Create aServiceBusProcessorClient
to consume events from the specified queue.- Specified by:
createProcessor
in 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:ServiceBusProcessorFactory
Create aServiceBusProcessorClient
to consume events from the specified queue.- Specified by:
createProcessor
in interfaceServiceBusProcessorFactory
- Parameters:
queue
- The queue name.containerProperties
- theServiceBusContainerProperties
to 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:ServiceBusProcessorFactory
Create aServiceBusProcessorClient
to consume events from the specified topic in the context of the given subscription.- Specified by:
createProcessor
in 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:ServiceBusProcessorFactory
Create aServiceBusProcessorClient
to consume events from the specified topic in the context of the given subscription.- Specified by:
createProcessor
in interfaceServiceBusProcessorFactory
- Parameters:
topic
- The topic.subscription
- The subscription.containerProperties
- theServiceBusContainerProperties
to describe the processor.- Returns:
- the topic processor client.
-
addListener
Description copied from interface:ServiceBusProcessorFactory
Add a listener for this factory.- Specified by:
addListener
in 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.ServiceBusProcessorClientBuilder
customizer 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.ServiceBusSessionProcessorClientBuilder
customizer 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 valueentityName
and 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 valueentityName
and 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.
-