ClientFactory Class

  • java.lang.Object
    • com.microsoft.azure.servicebus.ClientFactory

public class ClientFactory

Utility class for creating message senders and receivers.

Method Summary

Modifier and Type Method and Description
IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(MessagingFactory messagingFactory, String entityPath, String sessionId)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings)

Accept a IMessageSession from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings)

Accept a IMessageSession from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session.

IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings)

Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings)

Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

CompletableFuture<IMessageSession> acceptSessionFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString)

Create IMessageReceiver in default PEEKLOCK mode from service bus connection string with Shared Access Signatures

IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString, ReceiveMode receiveMode)

Create IMessageReceiver in default PEEKLOCK mode from service bus connection string with Shared Access Signatures

CompletableFuture<IMessageReceiver> createMessageReceiverFromConnectionStringAsync(String amqpConnectionString)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from connection string with Shared Access Signatures

CompletableFuture<IMessageReceiver> createMessageReceiverFromConnectionStringAsync(String amqpConnectionString, ReceiveMode receiveMode)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from connection string with Shared Access Signatures

IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder)

Create IMessageReceiver in default PEEKLOCK mode from ConnectionStringBuilder

IMessageReceiver messageReceiver = ClientFactory.createMessageReceiverFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName));

IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)

Create IMessageReceiver from ConnectionStringBuilder

IMessageReceiver messageReceiver = ClientFactory.createMessageReceiverFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName), ReceiveMode.PEEKLOCK);

CompletableFuture<IMessageReceiver> createMessageReceiverFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from ConnectionStringBuilder

CompletableFuture<IMessageReceiver> createMessageReceiverFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)

Create IMessageReceiver asynchronously from ConnectionStringBuilder

IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath)

Creates a message receiver to the entity.

IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode)

Creates a message receiver to the entity.

IMessageReceiver createMessageReceiverFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message receiver to the entity using the client settings in PeekLock mode

IMessageReceiver createMessageReceiverFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Creates a message receiver to the entity using the client settings.

IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message receiver to the entity using the client settings in PeekLock mode

IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Creates a message receiver to the entity using the client settings.

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath)

Asynchronously creates a new message receiver to the entity on the messagingFactory.

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode)

Asynchronously creates a new message receiver to the entity on the messagingFactory.

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings)

Asynchronously creates a message receiver to the entity using the client settings in PeekLock mode

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously creates a message receiver to the entity using the client settings

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Asynchronously creates a message receiver to the entity using the client settings in PeekLock mode

CompletableFuture<IMessageReceiver> createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously creates a message receiver to the entity using the client settings

IMessageSender createMessageSenderFromConnectionString(String amqpConnectionString)

Create message sender from service bus connection string with Shared Access Signatures

CompletableFuture<IMessageSender> createMessageSenderFromConnectionStringAsync(String amqpConnectionString)

Create message sender asynchronously from connection string with Shared Access Signatures

IMessageSender createMessageSenderFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder)

Create message sender from ConnectionStringBuilder

IMessageSender messageSender = ClientFactory.createMessageSenderFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName));

CompletableFuture<IMessageSender> createMessageSenderFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder)

Create message sender asynchronously from ConnectionStringBuilder

IMessageSender createMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath)

Creates a message sender to the entity.

IMessageSender createMessageSenderFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message sender to the entity using the client settings.

IMessageSender createMessageSenderFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message sender to the entity using the client settings.

CompletableFuture<IMessageSender> createMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath)

Creates a message sender asynchronously to the entity using the MessagingFactory

CompletableFuture<IMessageSender> createMessageSenderFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message sender asynchronously to the entity using the client settings.

CompletableFuture<IMessageSender> createMessageSenderFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message sender asynchronously to the entity using the client settings.

IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)

Creates a transfer message sender. This sender sends message to destination entity via another entity.

This is mainly to be used when sending messages in a transaction. When messages need to be sent across entities in a single transaction, this can be used to ensure all the messages land initially in the same entity/partition for local transactions, and then let service bus handle transferring the message to the actual destination.

CompletableFuture<IMessageSender> createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)

Creates a transfer message sender asynchronously. This sender sends message to destination entity via another entity.

This is mainly to be used when sending messages in a transaction. When messages need to be sent across entities in a single transaction, this can be used to ensure all the messages land initially in the same entity/partition for local transactions, and then let service bus handle transferring the message to the actual destination.

Method Details

acceptSessionFromConnectionString

public static IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionString - connection string
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromConnectionString

public static IMessageSession acceptSessionFromConnectionString(String amqpConnectionString, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionString - connection string
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromConnectionStringAsync

public static CompletableFuture acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionString - the connection string
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromConnectionStringAsync

public static CompletableFuture acceptSessionFromConnectionStringAsync(String amqpConnectionString, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession asynchronously from service bus connection string with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionString - the connection string
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromConnectionStringBuilder

public static IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionStringBuilder - the connection string builder
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromConnectionStringBuilder

public static IMessageSession acceptSessionFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionStringBuilder - the connection string builder
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromConnectionStringBuilderAsync

public static CompletableFuture acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId)

Accept a IMessageSession in default PEEKLOCK mode asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionStringBuilder - the connection string builder
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromConnectionStringBuilderAsync

public static CompletableFuture acceptSessionFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession asynchronously from service bus connection string builder with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

amqpConnectionStringBuilder - connection string builder
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(MessagingFactory messagingFactory, String entityPath, String sessionId)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which the session receiver needs to be created.
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which the session receiver needs to be created.
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings)

Accept a IMessageSession from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings)

Accept a IMessageSession from service bus using the client settings with specified session id in PeekLock mode. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPath

public static IMessageSession acceptSessionFromEntityPath(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Accept a IMessageSession from service bus using the client settings with specified session id. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageSession instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the session cannot be accepted

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which the session receiver needs to be created.
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String sessionId, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which the session receiver needs to be created.
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings)

Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(String namespaceName, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings)

Asynchronously accepts a session in PeekLock mode from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings

Returns:

a CompletableFuture representing the pending session accepting

acceptSessionFromEntityPathAsync

public static CompletableFuture acceptSessionFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, String sessionId, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously accepts a session from service bus using the client settings. Session Id can be null, if null, service will return the first available session.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
sessionId - session id, if null, service will return the first available session, otherwise, service will return specified session
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending session accepting

createMessageReceiverFromConnectionString

public static IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString)

Create IMessageReceiver in default PEEKLOCK mode from service bus connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string

Returns:

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromConnectionString

public static IMessageReceiver createMessageReceiverFromConnectionString(String amqpConnectionString, ReceiveMode receiveMode)

Create IMessageReceiver in default PEEKLOCK mode from service bus connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromConnectionStringAsync

public static CompletableFuture createMessageReceiverFromConnectionStringAsync(String amqpConnectionString)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string

Returns:

a CompletableFuture representing the pending creating

createMessageReceiverFromConnectionStringAsync

public static CompletableFuture createMessageReceiverFromConnectionStringAsync(String amqpConnectionString, ReceiveMode receiveMode)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending creating

createMessageReceiverFromConnectionStringBuilder

public static IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder)

Create IMessageReceiver in default PEEKLOCK mode from ConnectionStringBuilder

IMessageReceiver messageReceiver = ClientFactory.createMessageReceiverFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName));

Parameters:

amqpConnectionStringBuilder -

ConnectionStringBuilder

Returns:

The IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromConnectionStringBuilder

public static IMessageReceiver createMessageReceiverFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)

Create IMessageReceiver from ConnectionStringBuilder

IMessageReceiver messageReceiver = ClientFactory.createMessageReceiverFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName), ReceiveMode.PEEKLOCK);

Parameters:

amqpConnectionStringBuilder -

ConnectionStringBuilder

receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

The IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromConnectionStringBuilderAsync

public static CompletableFuture createMessageReceiverFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder)

Create IMessageReceiver in default PEEKLOCK mode asynchronously from ConnectionStringBuilder

Parameters:

amqpConnectionStringBuilder - the connection string builder

Returns:

a CompletableFuture representing the pending creating

createMessageReceiverFromConnectionStringBuilderAsync

public static CompletableFuture createMessageReceiverFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)

Create IMessageReceiver asynchronously from ConnectionStringBuilder

Parameters:

amqpConnectionStringBuilder - the connection string builder
receiveMode -

ReceiveMode PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending creating

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath)

Creates a message receiver to the entity.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which receiver needs to be created
entityPath - path of the entity

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode)

Creates a message receiver to the entity.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which receiver needs to be created
entityPath - path of the entity
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message receiver to the entity using the client settings in PeekLock mode

Parameters:

namespaceName - namespace of entity
entityPath - path of the entity
clientSettings - client settings

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Creates a message receiver to the entity using the client settings.

Parameters:

namespaceName - namespace of entity
entityPath - path of the entity
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message receiver to the entity using the client settings in PeekLock mode

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of the entity
clientSettings - client settings

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPath

public static IMessageReceiver createMessageReceiverFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Creates a message receiver to the entity using the client settings.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of the entity
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

IMessageReceiver instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the receiver cannot be created

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath)

Asynchronously creates a new message receiver to the entity on the messagingFactory.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which receiver needs to be created.
entityPath - path of entity

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode)

Asynchronously creates a new message receiver to the entity on the messagingFactory.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which receiver needs to be created.
entityPath - path of entity
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings)

Asynchronously creates a message receiver to the entity using the client settings in PeekLock mode

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
clientSettings - client settings

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously creates a message receiver to the entity using the client settings

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Asynchronously creates a message receiver to the entity using the client settings in PeekLock mode

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
clientSettings - client settings

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageReceiverFromEntityPathAsync

public static CompletableFuture createMessageReceiverFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Asynchronously creates a message receiver to the entity using the client settings

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
clientSettings - client settings
receiveMode - PeekLock or ReceiveAndDelete

Returns:

a CompletableFuture representing the pending creation of message receiver

createMessageSenderFromConnectionString

public static IMessageSender createMessageSenderFromConnectionString(String amqpConnectionString)

Create message sender from service bus connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createMessageSenderFromConnectionStringAsync

public static CompletableFuture createMessageSenderFromConnectionStringAsync(String amqpConnectionString)

Create message sender asynchronously from connection string with Shared Access Signatures

Parameters:

amqpConnectionString - the connection string

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance

createMessageSenderFromConnectionStringBuilder

public static IMessageSender createMessageSenderFromConnectionStringBuilder(ConnectionStringBuilder amqpConnectionStringBuilder)

Create message sender from ConnectionStringBuilder

IMessageSender messageSender = ClientFactory.createMessageSenderFromConnectionStringBuilder(new ConnectionStringBuilder(connectionString, queueName));

Parameters:

amqpConnectionStringBuilder - the connection string builder

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createMessageSenderFromConnectionStringBuilderAsync

public static CompletableFuture createMessageSenderFromConnectionStringBuilderAsync(ConnectionStringBuilder amqpConnectionStringBuilder)

Create message sender asynchronously from ConnectionStringBuilder

Parameters:

amqpConnectionStringBuilder - the connection string builder

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance

createMessageSenderFromEntityPath

public static IMessageSender createMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath)

Creates a message sender to the entity.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which sender needs to be created
entityPath - path of entity

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createMessageSenderFromEntityPath

public static IMessageSender createMessageSenderFromEntityPath(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message sender to the entity using the client settings.

Parameters:

namespaceName - namespace of entity
entityPath - path of entity
clientSettings - client settings

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createMessageSenderFromEntityPath

public static IMessageSender createMessageSenderFromEntityPath(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message sender to the entity using the client settings.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
clientSettings - client settings

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createMessageSenderFromEntityPathAsync

public static CompletableFuture createMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath)

Creates a message sender asynchronously to the entity using the MessagingFactory

Parameters:

messagingFactory - messaging factory (which represents a connection) on which sender needs to be created
entityPath - path of entity

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance

createMessageSenderFromEntityPathAsync

public static CompletableFuture createMessageSenderFromEntityPathAsync(String namespaceName, String entityPath, ClientSettings clientSettings)

Creates a message sender asynchronously to the entity using the client settings.

Parameters:

namespaceName - namespace name of entity
entityPath - path of entity
clientSettings - client settings

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance

createMessageSenderFromEntityPathAsync

public static CompletableFuture createMessageSenderFromEntityPathAsync(URI namespaceEndpointURI, String entityPath, ClientSettings clientSettings)

Creates a message sender asynchronously to the entity using the client settings.

Parameters:

namespaceEndpointURI - endpoint uri of entity namespace
entityPath - path of entity
clientSettings - client settings

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance

createTransferMessageSenderFromEntityPath

public static IMessageSender createTransferMessageSenderFromEntityPath(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)

Creates a transfer message sender. This sender sends message to destination entity via another entity.

This is mainly to be used when sending messages in a transaction. When messages need to be sent across entities in a single transaction, this can be used to ensure all the messages land initially in the same entity/partition for local transactions, and then let service bus handle transferring the message to the actual destination.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which sender needs to be created.
entityPath - path of the final destination of the message.
viaEntityPath - The initial destination of the message.

Returns:

IMessageSender instance

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if the sender cannot be created

createTransferMessageSenderFromEntityPathAsync

public static CompletableFuture createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath)

Creates a transfer message sender asynchronously. This sender sends message to destination entity via another entity.

This is mainly to be used when sending messages in a transaction. When messages need to be sent across entities in a single transaction, this can be used to ensure all the messages land initially in the same entity/partition for local transactions, and then let service bus handle transferring the message to the actual destination.

Parameters:

messagingFactory - messaging factory (which represents a connection) on which sender needs to be created.
entityPath - path of the final destination of the message.
viaEntityPath - The initial destination of the message.

Returns:

a CompletableFuture representing the pending creating of IMessageSender instance.

Applies to