MessagingFactory Class
- java.
lang. Object - ClientEntity
- com.
microsoft. azure. servicebus. primitives. MessagingFactory
- com.
public class MessagingFactory extends ClientEntity
Abstracts all AMQP related details and encapsulates an AMQP connection and manages its life cycle. Each instance of this class represent one AMQP connection to the namespace. If an application creates multiple senders, receivers or clients using the same MessagingFactory instance, all those senders, receivers or clients will share the same connection to the namespace.
Field Summary
Modifier and Type | Field and Description |
---|---|
final ExecutorService | INTERNAL_THREAD_POOL |
Method Summary
Modifier and Type | Method and Description |
---|---|
Messaging |
createFromConnectionString(final String connectionString)
Creates an instance of MessagingFactory from the given connection string. This method blocks for a connection to the namespace to be established. |
CompletableFuture<Messaging |
createFromConnectionStringAsync(final String connectionString)
Creates an instance of MessagingFactory from the given connection string. This is a non-blocking method. |
Messaging |
createFromConnectionStringBuilder(final ConnectionStringBuilder builder)
Creates an instance of MessagingFactory from the given connection string builder. This method blocks for a connection to the namespace to be established. |
CompletableFuture<Messaging |
createFromConnectionStringBuilderAsync(final ConnectionStringBuilder builder)
Creates an instance of MessagingFactory from the given connection string builder. This is a non-blocking method. |
Messaging |
createFromNamespaceEndpointURI(URI namespaceEndpointURI, ClientSettings clientSettings) |
CompletableFuture<Messaging |
createFromNamespaceEndpointURIAsyc(URI namespaceEndpointURI, ClientSettings clientSettings) |
Messaging |
createFromNamespaceName(String sbNamespaceName, ClientSettings clientSettings) |
CompletableFuture<Messaging |
createFromNamespaceNameAsyc(String sbNamespaceName, ClientSettings clientSettings) |
void |
deregisterForConnectionError(Link link)
Internal method.Clients should not use this method. |
void |
endTransaction(TransactionContext transaction, boolean commit)
Ends a transaction that was initiated using startTransactionAsync(). |
CompletableFuture<Void> |
endTransactionAsync(TransactionContext transaction, boolean commit)
Ends a transaction that was initiated using startTransactionAsync(). |
Client |
getClientSettings() |
String | getHostName() |
Duration |
getOperationTimeout()
Gets the operation timeout from the connections string. |
Retry |
getRetryPolicy()
Gets the retry policy from the connection string. |
CompletableFuture<Void> | onClose() |
void |
onConnectionError(ErrorCondition error)
Internal method.Clients should not use this method. |
void |
onConnectionOpen()
Internal method.Clients should not use this method. |
void |
registerForConnectionError(Link link)
Internal method.Clients should not use this method. |
Transaction |
startTransaction()
Starts a new service side transaction. The TransactionContext should be passed to all operations that needs to be in this transaction. |
CompletableFuture<Transaction |
startTransactionAsync()
Starts a new service side transaction. The TransactionContext should be passed to all operations that needs to be in this transaction. |
Inherited Members
Field Details
INTERNAL_THREAD_POOL
public static final ExecutorService INTERNAL_THREAD_POOL= Executors.newCachedThreadPool()
Method Details
createFromConnectionString
public static MessagingFactory createFromConnectionString(final String connectionString)
Creates an instance of MessagingFactory from the given connection string. This method blocks for a connection to the namespace to be established.
Parameters:
Returns:
Throws:
createFromConnectionStringAsync
public static CompletableFuture
Creates an instance of MessagingFactory from the given connection string. This is a non-blocking method.
Parameters:
Returns:
CompletableFuture
which completes when a connection is established to the namespace or when a connection couldn't be established.createFromConnectionStringBuilder
public static MessagingFactory createFromConnectionStringBuilder(final ConnectionStringBuilder builder)
Creates an instance of MessagingFactory from the given connection string builder. This method blocks for a connection to the namespace to be established.
Parameters:
Returns:
Throws:
createFromConnectionStringBuilderAsync
public static CompletableFuture
Creates an instance of MessagingFactory from the given connection string builder. This is a non-blocking method.
Parameters:
Returns:
CompletableFuture
which completes when a connection is established to the namespace or when a connection couldn't be established.createFromNamespaceEndpointURI
public static MessagingFactory createFromNamespaceEndpointURI(URI namespaceEndpointURI, ClientSettings clientSettings)
Parameters:
createFromNamespaceEndpointURIAsyc
public static CompletableFuture
Parameters:
createFromNamespaceName
public static MessagingFactory createFromNamespaceName(String sbNamespaceName, ClientSettings clientSettings)
Parameters:
createFromNamespaceNameAsyc
public static CompletableFuture
Parameters:
deregisterForConnectionError
public void deregisterForConnectionError(Link link)
Internal method.Clients should not use this method.
Parameters:
endTransaction
public void endTransaction(TransactionContext transaction, boolean commit)
Ends a transaction that was initiated using startTransactionAsync().
Parameters:
true
indicates transaction to be committed. A value of false
indicates a transaction rollback.
Throws:
endTransactionAsync
public CompletableFuture
Ends a transaction that was initiated using startTransactionAsync().
Parameters:
true
indicates transaction to be committed. A value of false
indicates a transaction rollback.
Returns:
CompletableFuture
getClientSettings
public ClientSettings getClientSettings()
getHostName
public String getHostName()
getOperationTimeout
public Duration getOperationTimeout()
Gets the operation timeout from the connections string.
Returns:
getRetryPolicy
public RetryPolicy getRetryPolicy()
Gets the retry policy from the connection string.
Returns:
onClose
protected CompletableFuture
onConnectionError
public void onConnectionError(ErrorCondition error)
Internal method.Clients should not use this method.
Parameters:
onConnectionOpen
public void onConnectionOpen()
Internal method.Clients should not use this method.
registerForConnectionError
public void registerForConnectionError(Link link)
Internal method.Clients should not use this method.
Parameters:
startTransaction
public TransactionContext startTransaction()
Starts a new service side transaction. The TransactionContext should be passed to all operations that needs to be in this transaction.
Returns:
Throws:
startTransactionAsync
public CompletableFuture
Starts a new service side transaction. The TransactionContext should be passed to all operations that needs to be in this transaction.
Returns:
CompletableFuture
which returns a new transactionApplies to
Azure SDK for Java