com.microsoft.azure.servicebus.primitives

定义

AuthorizationFailedException

Authorization failed exception is thrown when error is encountered during authorizing user's permission to run the intended operations. When encountered this exception user should check whether the token/key provided in the connection string is valid, and has correct execution right for the intended operations (e.g. Receive call will need Listen claim associated with the key/token).

ClientConstants
ClientEntity

Contract for all client entities with Open-Close/Abort state m/c

main-purpose: closeAll related entities

Internal-class

CommunicationException

This exception is thrown when there is a client side connectivity issue. When receiving this exception user should check client connectivity settings to the service:

  • Check for correct hostname and port number used in endpoint.

  • Check for any possible proxy settings that can block amqp ports

  • Check for any firewall settings that can block amqp ports

  • Check for any general network connectivity issues, as well as network latency.

ConnectionStringBuilder

This class can be used to construct a connection string which can establish communication with ServiceBus entities. It can also be used to perform basic validation on an existing connection string.

Sample Code:

ConnectionStringBuilder connectionStringBuilder = new ConnectionStringBuilder(
                                         "ServiceBusNamespaceName", 

                                         "ServiceBusEntityName", // QueueName or TopicName or SubscriptionPath

                                         "SharedAccessSignatureKeyName", 

                                         "SharedAccessSignatureKey");

 

String connectionString = connectionStringBuilder.toString();

</code></pre></p>

A connection string is basically a string consisted of key-value pair separated by ";". Basic format is {{ <}key{>}={ <}value{>}[;{ <}key{>}={ <}value{>}]} where supported key name are as follow:

  • Endpoint - URL that points to the servicebus namespace

  • EntityPath - Path to the service bus entity (queue/topic/subscription/). For queues and topics, it is just the entity name. For subscriptions, path is <topicName>/subscriptions/<subscriptionName>

  • SharedAccessKeyName - Key name to the corresponding shared access policy rule for the namespace, or entity.

  • SharedAccessKey - Key value for the corresponding shared access policy rule of the namespace or entity.

  • SharedAccessSignatureToken - Instead of a key name and key value, clients can provide an already generated SAS Token.

  • OperationTimeout - Default timeout to be used for all senders, receiver and clients created from this connection string.

  • RetryPolicy - Name of the retry policy.

CoreMessageReceiver
CoreMessageSender
ExceptionUtil
IllegalConnectionStringFormatException

This exception is thrown when the connection string provided does not meet the requirement for connection.

MessageLockLostException

This exception is thrown when a receiver attempts or or or or operation on a peek-locked message whose lock had already expired.

MessageNotFoundException

This exception is thrown when a receiver attempts to receive a message with sequence number and the message with that sequence number is not available in the queue or subscription.

MessageWithDeliveryTag
MessageWithLockToken
MessagingEntityAlreadyExistsException

This exception is thrown when a subscription client tries to create a rule with the name of an already existing rule.

MessagingEntityDisabledException

This exception is thrown when a client attempts to send messages to or receive messages from a disabled entity. An entity can be disabled for Send operations or RECEIVE operations or both.

MessagingEntityNotFoundException

This exception is thrown when a client attempts to create a sender or receiver or client to a non existent entity.

MessagingFactory

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.

MiscRequestResponseOperationHandler
OperationCancelledException

This exception is thrown when the underlying Amqp layer encounter an abnormal link abort or disconnect of connection in an unexpected fashion.

Pair<T,V>
PayloadSizeExceededException

this exception is thrown when user attempts to send a event data or brokered message that has exceeded the allowed payload size as defined by the service. Note that in a batch send scenario the limit can include possible batch overhead.

QuotaExceededException

This exception is thrown to signal that a service bus entity or namespace exceeded its quota. A quota can be a limit on entity size, message size, maximum concurrent connections or maximum concurrent operations.

ReceiverDisconnectedException

This exception is thrown when a EventHubReceiver is being disconnected because of one of the following reason:

  • user attempts to connect a non-epoch receiver to a event hub partition, when there is an epoch receiver connected to the partition.

  • you are using an epoch receiver for a given partition but another epoch receiver with a higher epoch value connects to the same partition.

User should make sure either all code are using non-epoch receivers, or ensure that there is only one epoch receiver processing a given partition at any given point in time.

ReceiverErrorContext
RequestResponseUtils
RequestResponseWorkItem
RetryExponential

RetryPolicy implementation where the delay between retries will grow in an exponential manner. RetryPolicy can be set on the client operations using ConnectionStringBuilder. RetryIntervals will be computed using a retryFactor which is a function of deltaBackOff (MaximumBackoff - MinimumBackoff) and MaximumRetryCount

RetryPolicy

Represents an abstraction of a policy for retrying messaging operations when an exception is encountered. Some exceptions encountered by a sender or receiver can be transient like ServerBusy and the operation will succeed if retried. Clients can specify a retry policy using ConnectionStringBuilder which guides senders and receivers to automatically retry the failed operation before throwing the exception to the client application. Users should not implement this class, instead should use one of the provided implementations through getDefault() or getNoRetry().

SASUtil

<xreftitle>Deprecated</xreftitle>

<xrefdescription>

  <p>Use <xref uid="com.microsoft.azure.servicebus.security.SharedAccessSignatureTokenProvider" data-throw-if-not-resolved="false" data-raw-source="com.microsoft.azure.servicebus.security.SharedAccessSignatureTokenProvider"></xref></p>

</xrefdescription>

SenderErrorContext
ServerBusyException

Server busy exception is thrown when the current entity's activity has put excessive load onto the service. When encountered this exception user should wait at least 4 seconds before any retry/runtime operations for the said entity again.

ServiceBusException

This is the base exception that service bus will generate for all error cases.

SessionCannotBeLockedException

This exception is thrown when a client attempts to accept a session that is already locked by another client.

SessionLockLostException

This exception is thrown when a session receiver performs an operation on a session after its lock is expired. When a client accepts a session, the session is locked to the receiver for a duration specified in the entity definition. When the accepted session remains idle for the duration of lock, that is no operations performed on the session, the lock expires and the session is made available to other clients.

SettleModePair
StringUtil
TimeoutException

This exception is thrown when the operation has exceeded the predetermined time limit. User should check connectivity is healthy between client process and service.

TimeoutTracker
Timer

An abstraction for a Scheduler functionality - which can later be replaced by a light-weight Thread

TrackingUtil
Util

枚举

MessagingEntityType
TimerType
TransportType

All TransportType switches available for communicating to EventHubs service.