SubscriptionClient Class

  • java.lang.Object
    • ClientEntity
      • com.microsoft.azure.servicebus.InitializableEntity
        • com.microsoft.azure.servicebus.SubscriptionClient

public class SubscriptionClient implements ISubscriptionClient

Field Summary

Modifier and Type Field and Description
final String DEFAULT_RULE_NAME

Constructor Summary

Constructor Description
SubscriptionClient(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)
SubscriptionClient(String namespace, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode)
SubscriptionClient(URI namespaceEndpointURI, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Method Summary

Modifier and Type Method and Description
void abandon(UUID lockToken)
void abandon(UUID lockToken, Map<String, Object> propertiesToModify)
void abandon(UUID lockToken, Map<String, Object> propertiesToModify, TransactionContext transaction)
void abandon(UUID lockToken, TransactionContext transaction)
CompletableFuture<Void> abandonAsync(UUID lockToken)
CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String, Object> propertiesToModify)
CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String, Object> propertiesToModify, TransactionContext transaction)
CompletableFuture<Void> abandonAsync(UUID lockToken, TransactionContext transaction)
void addRule(RuleDescription ruleDescription)

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

void addRule(String ruleName, Filter filter)

Adds a rule with specified name and Filter to the current subscription to filter the messages reaching from topic to the subscription.

CompletableFuture<Void> addRuleAsync(RuleDescription ruleDescription)

Asynchronously adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

CompletableFuture<Void> addRuleAsync(String ruleName, Filter filter)

Asynchronously adds a rule with specified name and Filter to the current subscription to filter the messages reaching from topic to the subscription.

void complete(UUID lockToken)
void complete(UUID lockToken, TransactionContext transaction)
CompletableFuture<Void> completeAsync(UUID lockToken)
CompletableFuture<Void> completeAsync(UUID lockToken, TransactionContext transaction)
void deadLetter(UUID lockToken)
void deadLetter(UUID lockToken, Map<String, Object> propertiesToModify)
void deadLetter(UUID lockToken, Map<String, Object> propertiesToModify, TransactionContext transaction)
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String, Object> propertiesToModify)
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String, Object> propertiesToModify, TransactionContext transaction)
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
void deadLetter(UUID lockToken, TransactionContext transaction)
CompletableFuture<Void> deadLetterAsync(UUID lockToken)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String, Object> propertiesToModify)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String, Object> propertiesToModify, TransactionContext transaction)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String, Object> propertiesToModify)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String, Object> propertiesToModify, TransactionContext transaction)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
CompletableFuture<Void> deadLetterAsync(UUID lockToken, TransactionContext transaction)
String getEntityPath()

Gets the path of the entity this client is sending messages to or receiving messages from.

int getPrefetchCount()
ReceiveMode getReceiveMode()

Gets the ReceiveMode of the current receiver

Collection<RuleDescription> getRules()

Get all rules associated with the subscription.

CompletableFuture<Collection<RuleDescription>> getRulesAsync()

Get all rules associated with the subscription.

String getSubscriptionName()

Gets the subscription name.

String getTopicName()

Gets the name of the topic, for this subscription.

CompletableFuture<Void> onClose()
void registerMessageHandler(IMessageHandler handler)
void registerMessageHandler(IMessageHandler handler, ExecutorService executorService)
void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions)
void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions, ExecutorService executorService)
void registerSessionHandler(ISessionHandler handler)
void registerSessionHandler(ISessionHandler handler, ExecutorService executorService)
void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions)
void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions, ExecutorService executorService)
void removeRule(String ruleName)

Removes the rule on the subscription identified by ruleName

CompletableFuture<Void> removeRuleAsync(String ruleName)

Asynchronously removes the rule on the subscription identified by ruleName

void setPrefetchCount(int prefetchCount)

Inherited Members

Field Details

DEFAULT_RULE_NAME

public static final String DEFAULT_RULE_NAME= "$Default"

Constructor Details

SubscriptionClient

public SubscriptionClient(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode)

Parameters:

amqpConnectionStringBuilder
receiveMode

SubscriptionClient

public SubscriptionClient(String namespace, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Parameters:

namespace
subscriptionPath
clientSettings
receiveMode

SubscriptionClient

public SubscriptionClient(URI namespaceEndpointURI, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode)

Parameters:

namespaceEndpointURI
subscriptionPath
clientSettings
receiveMode

Method Details

abandon

public void abandon(UUID lockToken)

Parameters:

lockToken

abandon

public void abandon(UUID lockToken, Map propertiesToModify)

Parameters:

lockToken
propertiesToModify

abandon

public void abandon(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
propertiesToModify
transaction

abandon

public void abandon(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

abandonAsync

public CompletableFuture abandonAsync(UUID lockToken)

Parameters:

lockToken

abandonAsync

public CompletableFuture abandonAsync(UUID lockToken, Map propertiesToModify)

Parameters:

lockToken
propertiesToModify

abandonAsync

public CompletableFuture abandonAsync(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
propertiesToModify
transaction

abandonAsync

public CompletableFuture abandonAsync(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

addRule

public void addRule(RuleDescription ruleDescription)

Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

Overrides:

SubscriptionClient.addRule(RuleDescription ruleDescription)

Parameters:

ruleDescription - The rule description that provides the rule to add.

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if add rule failed

addRule

public void addRule(String ruleName, Filter filter)

Adds a rule with specified name and Filter to the current subscription to filter the messages reaching from topic to the subscription.

Overrides:

SubscriptionClient.addRule(String ruleName, Filter filter)

Parameters:

ruleName - The rule name
filter - The Filter to add.

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if add rule failed

addRuleAsync

public CompletableFuture addRuleAsync(RuleDescription ruleDescription)

Asynchronously adds a rule to the current subscription to filter the messages reaching from topic to the subscription.

Overrides:

SubscriptionClient.addRuleAsync(RuleDescription ruleDescription)

Parameters:

ruleDescription - The rule description that provides the rule to add.

Returns:

a CompletableFuture representing the pending rule add operation.

addRuleAsync

public CompletableFuture addRuleAsync(String ruleName, Filter filter)

Asynchronously adds a rule with specified name and Filter to the current subscription to filter the messages reaching from topic to the subscription.

Overrides:

SubscriptionClient.addRuleAsync(String ruleName, Filter filter)

Parameters:

ruleName - The rule name
filter - The Filter to add.

Returns:

a CompletableFuture representing the pending rule add operation.

complete

public void complete(UUID lockToken)

Parameters:

lockToken

complete

public void complete(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

completeAsync

public CompletableFuture completeAsync(UUID lockToken)

Parameters:

lockToken

completeAsync

public CompletableFuture completeAsync(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

deadLetter

public void deadLetter(UUID lockToken)

Parameters:

lockToken

deadLetter

public void deadLetter(UUID lockToken, Map propertiesToModify)

Parameters:

lockToken
propertiesToModify

deadLetter

public void deadLetter(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
propertiesToModify
transaction

deadLetter

public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription

deadLetter

public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
propertiesToModify

deadLetter

public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
propertiesToModify
transaction

deadLetter

public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
transaction

deadLetter

public void deadLetter(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken)

Parameters:

lockToken

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, Map propertiesToModify)

Parameters:

lockToken
propertiesToModify

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
propertiesToModify
transaction

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
propertiesToModify

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify, TransactionContext transaction)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
propertiesToModify
transaction

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Parameters:

lockToken
deadLetterReason
deadLetterErrorDescription
transaction

deadLetterAsync

public CompletableFuture deadLetterAsync(UUID lockToken, TransactionContext transaction)

Parameters:

lockToken
transaction

getEntityPath

public String getEntityPath()

Gets the path of the entity this client is sending messages to or receiving messages from.

Overrides:

SubscriptionClient.getEntityPath()

Returns:

path of the entity this client is connecting to

getPrefetchCount

public int getPrefetchCount()

getReceiveMode

public ReceiveMode getReceiveMode()

Gets the ReceiveMode of the current receiver

Overrides:

SubscriptionClient.getReceiveMode()

Returns:

The receive mode.

getRules

public Collection getRules()

Get all rules associated with the subscription.

Overrides:

SubscriptionClient.getRules()

Returns:

The collection fo the rules.

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if get rules failed

getRulesAsync

public CompletableFuture> getRulesAsync()

Get all rules associated with the subscription.

Overrides:

SubscriptionClient.getRulesAsync()

Returns:

a CompletableFuture representing the pending get rules operation.

getSubscriptionName

public String getSubscriptionName()

Gets the subscription name.

Overrides:

SubscriptionClient.getSubscriptionName()

Returns:

The subscription name.

getTopicName

public String getTopicName()

Gets the name of the topic, for this subscription.

Overrides:

SubscriptionClient.getTopicName()

Returns:

the name of the topic

onClose

protected CompletableFuture onClose()

registerMessageHandler

public void registerMessageHandler(IMessageHandler handler)

Parameters:

handler

registerMessageHandler

public void registerMessageHandler(IMessageHandler handler, ExecutorService executorService)

Parameters:

handler
executorService

registerMessageHandler

public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions)

Parameters:

handler
handlerOptions

registerMessageHandler

public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions, ExecutorService executorService)

Parameters:

handler
handlerOptions
executorService

registerSessionHandler

public void registerSessionHandler(ISessionHandler handler)

Parameters:

handler

registerSessionHandler

public void registerSessionHandler(ISessionHandler handler, ExecutorService executorService)

Parameters:

handler
executorService

registerSessionHandler

public void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions)

Parameters:

handler
handlerOptions

registerSessionHandler

public void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions, ExecutorService executorService)

Parameters:

handler
handlerOptions
executorService

removeRule

public void removeRule(String ruleName)

Removes the rule on the subscription identified by ruleName

Overrides:

SubscriptionClient.removeRule(String ruleName)

Parameters:

ruleName - The name of rule.

Throws:

InterruptedException - if the current thread was interrupted while waiting
ServiceBusException - if remove rule failed

removeRuleAsync

public CompletableFuture removeRuleAsync(String ruleName)

Asynchronously removes the rule on the subscription identified by ruleName

Overrides:

SubscriptionClient.removeRuleAsync(String ruleName)

Parameters:

ruleName - he name of rule.

Returns:

a CompletableFuture representing the pending rule remove operation.

setPrefetchCount

public void setPrefetchCount(int prefetchCount)

Parameters:

prefetchCount

Applies to