Package com.microsoft.azure.servicebus
Class SubscriptionClient
- java.lang.Object
-
- com.microsoft.azure.servicebus.primitives.ClientEntity
-
- com.microsoft.azure.servicebus.SubscriptionClient
-
- All Implemented Interfaces:
ICloseable
,IMessageEntityClient
,ISubscriptionClient
public final class SubscriptionClient extends ClientEntity implements ISubscriptionClient
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_RULE_NAME
-
Constructor Summary
Constructors 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
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
abandon(UUID lockToken)
void
abandon(UUID lockToken, TransactionContext transaction)
void
abandon(UUID lockToken, Map<String,Object> propertiesToModify)
void
abandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
CompletableFuture<Void>
abandonAsync(UUID lockToken)
CompletableFuture<Void>
abandonAsync(UUID lockToken, TransactionContext transaction)
CompletableFuture<Void>
abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)
CompletableFuture<Void>
abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, 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 andFilter
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 andFilter
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, TransactionContext transaction)
void
deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
void
deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
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, Map<String,Object> propertiesToModify)
void
deadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
CompletableFuture<Void>
deadLetterAsync(UUID lockToken)
CompletableFuture<Void>
deadLetterAsync(UUID lockToken, TransactionContext transaction)
CompletableFuture<Void>
deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
CompletableFuture<Void>
deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
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, Map<String,Object> propertiesToModify)
CompletableFuture<Void>
deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, 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 theReceiveMode
of the current receiverCollection<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.protected CompletableFuture<Void>
onClose()
void
registerMessageHandler(IMessageHandler handler)
Deprecated.void
registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions)
Deprecated.void
registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions, ExecutorService executorService)
void
registerMessageHandler(IMessageHandler handler, ExecutorService executorService)
void
registerSessionHandler(ISessionHandler handler)
Deprecated.void
registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions)
Deprecated.void
registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions, ExecutorService executorService)
void
registerSessionHandler(ISessionHandler handler, ExecutorService executorService)
void
removeRule(String ruleName)
Removes the rule on the subscription identified by ruleNameCompletableFuture<Void>
removeRuleAsync(String ruleName)
Asynchronously removes the rule on the subscription identified by ruleNamevoid
setPrefetchCount(int prefetchCount)
-
Methods inherited from class com.microsoft.azure.servicebus.primitives.ClientEntity
close, closeAsync, finalize, getClientId, getIsClosed, getIsClosingOrClosed, setClosed, setClosing, throwIfClosed
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.microsoft.azure.servicebus.ICloseable
close, closeAsync
-
-
-
-
Field Detail
-
DEFAULT_RULE_NAME
public static final String DEFAULT_RULE_NAME
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SubscriptionClient
public SubscriptionClient(ConnectionStringBuilder amqpConnectionStringBuilder, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException
-
SubscriptionClient
public SubscriptionClient(String namespace, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException
-
SubscriptionClient
public SubscriptionClient(URI namespaceEndpointURI, String subscriptionPath, ClientSettings clientSettings, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException
-
-
Method Detail
-
getReceiveMode
public ReceiveMode getReceiveMode()
Description copied from interface:ISubscriptionClient
Gets theReceiveMode
of the current receiver- Specified by:
getReceiveMode
in interfaceISubscriptionClient
- Returns:
- The receive mode.
-
getEntityPath
public String getEntityPath()
Description copied from interface:IMessageEntityClient
Gets the path of the entity this client is sending messages to or receiving messages from.- Specified by:
getEntityPath
in interfaceIMessageEntityClient
- Returns:
- path of the entity this client is connecting to
-
addRule
public void addRule(RuleDescription ruleDescription) throws InterruptedException, ServiceBusException
Description copied from interface:ISubscriptionClient
Adds a rule to the current subscription to filter the messages reaching from topic to the subscription.- Specified by:
addRule
in interfaceISubscriptionClient
- Parameters:
ruleDescription
- The rule description that provides the rule to add.- Throws:
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if add rule failed
-
addRuleAsync
public CompletableFuture<Void> addRuleAsync(RuleDescription ruleDescription)
Description copied from interface:ISubscriptionClient
Asynchronously adds a rule to the current subscription to filter the messages reaching from topic to the subscription.- Specified by:
addRuleAsync
in interfaceISubscriptionClient
- Parameters:
ruleDescription
- The rule description that provides the rule to add.- Returns:
- a CompletableFuture representing the pending rule add operation.
-
addRule
public void addRule(String ruleName, Filter filter) throws InterruptedException, ServiceBusException
Description copied from interface:ISubscriptionClient
Adds a rule with specified name andFilter
to the current subscription to filter the messages reaching from topic to the subscription.- Specified by:
addRule
in interfaceISubscriptionClient
- Parameters:
ruleName
- The rule namefilter
- TheFilter
to add.- Throws:
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if add rule failed
-
addRuleAsync
public CompletableFuture<Void> addRuleAsync(String ruleName, Filter filter)
Description copied from interface:ISubscriptionClient
Asynchronously adds a rule with specified name andFilter
to the current subscription to filter the messages reaching from topic to the subscription.- Specified by:
addRuleAsync
in interfaceISubscriptionClient
- Parameters:
ruleName
- The rule namefilter
- TheFilter
to add.- Returns:
- a CompletableFuture representing the pending rule add operation.
-
removeRule
public void removeRule(String ruleName) throws InterruptedException, ServiceBusException
Description copied from interface:ISubscriptionClient
Removes the rule on the subscription identified by ruleName- Specified by:
removeRule
in interfaceISubscriptionClient
- Parameters:
ruleName
- The name of rule.- Throws:
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if remove rule failed
-
removeRuleAsync
public CompletableFuture<Void> removeRuleAsync(String ruleName)
Description copied from interface:ISubscriptionClient
Asynchronously removes the rule on the subscription identified by ruleName- Specified by:
removeRuleAsync
in interfaceISubscriptionClient
- Parameters:
ruleName
- he name of rule.- Returns:
- a CompletableFuture representing the pending rule remove operation.
-
getRules
public Collection<RuleDescription> getRules() throws ServiceBusException, InterruptedException
Description copied from interface:ISubscriptionClient
Get all rules associated with the subscription.- Specified by:
getRules
in interfaceISubscriptionClient
- Returns:
- The collection fo the rules.
- Throws:
ServiceBusException
- if get rules failedInterruptedException
- if the current thread was interrupted while waiting
-
getRulesAsync
public CompletableFuture<Collection<RuleDescription>> getRulesAsync()
Description copied from interface:ISubscriptionClient
Get all rules associated with the subscription.- Specified by:
getRulesAsync
in interfaceISubscriptionClient
- Returns:
- a CompletableFuture representing the pending get rules operation.
-
registerMessageHandler
@Deprecated public void registerMessageHandler(IMessageHandler handler) throws InterruptedException, ServiceBusException
Deprecated.
-
registerMessageHandler
@Deprecated public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions) throws InterruptedException, ServiceBusException
Deprecated.
-
registerSessionHandler
@Deprecated public void registerSessionHandler(ISessionHandler handler) throws InterruptedException, ServiceBusException
Deprecated.
-
registerSessionHandler
@Deprecated public void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions) throws InterruptedException, ServiceBusException
Deprecated.
-
registerMessageHandler
public void registerMessageHandler(IMessageHandler handler, ExecutorService executorService) throws InterruptedException, ServiceBusException
-
registerMessageHandler
public void registerMessageHandler(IMessageHandler handler, MessageHandlerOptions handlerOptions, ExecutorService executorService) throws InterruptedException, ServiceBusException
-
registerSessionHandler
public void registerSessionHandler(ISessionHandler handler, ExecutorService executorService) throws InterruptedException, ServiceBusException
-
registerSessionHandler
public void registerSessionHandler(ISessionHandler handler, SessionHandlerOptions handlerOptions, ExecutorService executorService) throws InterruptedException, ServiceBusException
-
onClose
protected CompletableFuture<Void> onClose()
- Specified by:
onClose
in classClientEntity
-
abandon
public void abandon(UUID lockToken) throws InterruptedException, ServiceBusException
-
abandon
public void abandon(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
abandon
public void abandon(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
-
abandon
public void abandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
abandonAsync
public CompletableFuture<Void> abandonAsync(UUID lockToken)
-
abandonAsync
public CompletableFuture<Void> abandonAsync(UUID lockToken, TransactionContext transaction)
-
abandonAsync
public CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)
-
abandonAsync
public CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
-
complete
public void complete(UUID lockToken) throws InterruptedException, ServiceBusException
-
complete
public void complete(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
completeAsync
public CompletableFuture<Void> completeAsync(UUID lockToken)
-
completeAsync
public CompletableFuture<Void> completeAsync(UUID lockToken, TransactionContext transaction)
-
deadLetter
public void deadLetter(UUID lockToken) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
-
deadLetter
public void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, TransactionContext transaction)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)
-
deadLetterAsync
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)
-
getPrefetchCount
public int getPrefetchCount()
-
setPrefetchCount
public void setPrefetchCount(int prefetchCount) throws ServiceBusException
- Throws:
ServiceBusException
-
getTopicName
public String getTopicName()
Description copied from interface:ISubscriptionClient
Gets the name of the topic, for this subscription.- Specified by:
getTopicName
in interfaceISubscriptionClient
- Returns:
- the name of the topic
-
getSubscriptionName
public String getSubscriptionName()
Description copied from interface:ISubscriptionClient
Gets the subscription name.- Specified by:
getSubscriptionName
in interfaceISubscriptionClient
- Returns:
- The subscription name.
-
-