Class DefaultServiceBusNamespaceProducerFactory
java.lang.Object
com.azure.spring.messaging.servicebus.core.DefaultServiceBusNamespaceProducerFactory
- All Implemented Interfaces:
ServiceBusProducerFactory,org.springframework.beans.factory.DisposableBean
public final class DefaultServiceBusNamespaceProducerFactory
extends Object
implements ServiceBusProducerFactory, org.springframework.beans.factory.DisposableBean
The
ServiceBusProducerFactory implementation to produce new ServiceBusSenderAsyncClient instances
for provided NamespaceProperties and optional producer PropertiesSupplier on each
createProducer(java.lang.String) invocation.
ServiceBusSenderAsyncClient produced by this factory will share the same namespace level configuration, but
if a configuration entry is provided at both producer and namespace level, the producer level configuration will
take advantage.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.azure.spring.messaging.servicebus.core.ServiceBusProducerFactory
ServiceBusProducerFactory.Listener -
Constructor Summary
ConstructorsConstructorDescriptionDefaultServiceBusNamespaceProducerFactory(NamespaceProperties namespaceProperties) Construct a factory with the provided namespace level configuration.DefaultServiceBusNamespaceProducerFactory(NamespaceProperties namespaceProperties, PropertiesSupplier<String, ProducerProperties> supplier) Construct a factory with the provided namespace level configuration and producerPropertiesSupplier. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSenderClientBuilder> customizer) Add a service client builder customizer to customize all the clients created from this factory.voidaddBuilderCustomizer(String entityName, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSenderClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with service bus entity name of valueentityName.voidAdd a listener for this factory.voidaddServiceBusClientBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder> customizer) Add aServiceBusClientBuildercustomizer to customize the shared client builder created in this factory, it's used to build other sender clients.com.azure.messaging.servicebus.ServiceBusSenderAsyncClientcreateProducer(String name) CreateServiceBusSenderAsyncClientto send events to the Service Bus queue/topic entity.com.azure.messaging.servicebus.ServiceBusSenderAsyncClientcreateProducer(String name, com.azure.spring.cloud.service.servicebus.properties.ServiceBusEntityType entityType) CreateServiceBusSenderAsyncClientto send events to the Service Bus queue/topic entity with explicitServiceBusEntityType.voiddestroy()booleanRemove a listenervoidsetDefaultCredential(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
-
DefaultServiceBusNamespaceProducerFactory
Construct a factory with the provided namespace level configuration.- Parameters:
namespaceProperties- the namespace properties
-
DefaultServiceBusNamespaceProducerFactory
public DefaultServiceBusNamespaceProducerFactory(NamespaceProperties namespaceProperties, PropertiesSupplier<String, ProducerProperties> supplier) Construct a factory with the provided namespace level configuration and producerPropertiesSupplier.- Parameters:
namespaceProperties- the namespace properties.supplier- thePropertiesSupplierto supplyProducerPropertiesfor each queue/topic entity.
-
-
Method Details
-
createProducer
Description copied from interface:ServiceBusProducerFactoryCreateServiceBusSenderAsyncClientto send events to the Service Bus queue/topic entity.- Specified by:
createProducerin interfaceServiceBusProducerFactory- Parameters:
name- the destination entity name- Returns:
- the producer.
-
createProducer
public com.azure.messaging.servicebus.ServiceBusSenderAsyncClient createProducer(String name, com.azure.spring.cloud.service.servicebus.properties.ServiceBusEntityType entityType) Description copied from interface:ServiceBusProducerFactoryCreateServiceBusSenderAsyncClientto send events to the Service Bus queue/topic entity with explicitServiceBusEntityType.- Specified by:
createProducerin interfaceServiceBusProducerFactory- Parameters:
name- the destination entity name.entityType- the Service Bus entity type.- Returns:
- the producer.
-
addListener
Description copied from interface:ServiceBusProducerFactoryAdd a listener for this factory.- Specified by:
addListenerin interfaceServiceBusProducerFactory- Parameters:
listener- the listener
-
removeListener
Description copied from interface:ServiceBusProducerFactoryRemove a listener- Specified by:
removeListenerin interfaceServiceBusProducerFactory- Parameters:
listener- the listener- Returns:
- true if removed.
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.springframework.beans.factory.DisposableBean
-
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.
-
addServiceBusClientBuilderCustomizer
public void addServiceBusClientBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder> customizer) Add aServiceBusClientBuildercustomizer to customize the shared client builder created in this factory, it's used to build other sender clients.- Parameters:
customizer- the provided builder customizer.
-
addBuilderCustomizer
public void addBuilderCustomizer(com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSenderClientBuilder> 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 entityName, com.azure.spring.cloud.core.customizer.AzureServiceClientBuilderCustomizer<com.azure.messaging.servicebus.ServiceBusClientBuilder.ServiceBusSenderClientBuilder> customizer) Add a service client builder customizer to customize the clients created from this factory with service bus entity name of valueentityName.- Parameters:
entityName- the entity name of the client.customizer- the provided customizer.
-