public final class ServiceBusClientBuilder.ServiceBusReceiverClientBuilder extends Object
ServiceBusReceiverClient
and ServiceBusReceiverAsyncClient
to consume
messages from Service Bus.Modifier and Type | Method and Description |
---|---|
ServiceBusReceiverAsyncClient |
buildAsyncClient()
Creates an asynchronous Service Bus receiver responsible for reading
messages from a specific queue or subscription. |
ServiceBusReceiverClient |
buildClient()
Creates synchronous Service Bus receiver responsible for reading
messages
from a specific queue or subscription. |
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
disableAutoComplete()
Disables auto-complete and auto-abandon of received messages.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
maxAutoLockRenewDuration(Duration maxAutoLockRenewDuration)
Sets the amount of time to continue auto-renewing the lock.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
prefetchCount(int prefetchCount)
Sets the prefetch count of the receiver.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
queueName(String queueName)
Sets the name of the queue to create a receiver for.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
receiveMode(ServiceBusReceiveMode receiveMode)
Sets the receive mode for the receiver.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
subQueue(SubQueue subQueue)
Sets the type of the
SubQueue to connect to. |
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
subscriptionName(String subscriptionName)
Sets the name of the subscription in the topic to listen to.
|
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder |
topicName(String topicName)
Sets the name of the topic.
|
public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder disableAutoComplete()
completed
. If an error happens when
the message is processed, it is abandoned
.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder maxAutoLockRenewDuration(Duration maxAutoLockRenewDuration)
Duration.ZERO
or null
disables auto-renewal. For RECEIVE_AND_DELETE
mode,
auto-renewal is disabled.maxAutoLockRenewDuration
- the amount of time to continue auto-renewing the lock. Duration.ZERO
or null
indicates that auto-renewal is disabled.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.IllegalArgumentException
- If {code maxAutoLockRenewDuration} is negative.public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder prefetchCount(int prefetchCount)
PEEK_LOCK
and
RECEIVE_AND_DELETE
modes the default value is 1.
Prefetch speeds up the message flow by aiming to have a message readily available for local retrieval when
and before the application asks for one using ServiceBusReceiverAsyncClient.receiveMessages()
.
Setting a non-zero value will prefetch that number of messages. Setting the value to zero turns prefetch
off.prefetchCount
- The prefetch count.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.IllegalArgumentException
- If {code prefetchCount} is negative.public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder queueName(String queueName)
queueName
- Name of the queue.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder receiveMode(ServiceBusReceiveMode receiveMode)
receiveMode
- Mode for receiving messages.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder subQueue(SubQueue subQueue)
SubQueue
to connect to.subQueue
- The type of the sub queue.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.A queuename or #topicName A topic name should be set as well.
public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder subscriptionName(String subscriptionName)
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder.topicName(String)
must also be set.
subscriptionName
- Name of the subscription.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.A topic name should be set as well.
public ServiceBusClientBuilder.ServiceBusReceiverClientBuilder topicName(String topicName)
ServiceBusClientBuilder.ServiceBusReceiverClientBuilder.subscriptionName(String)
must also be set.topicName
- Name of the topic.ServiceBusClientBuilder.ServiceBusReceiverClientBuilder
object.A subscription name should be set as well.
public ServiceBusReceiverAsyncClient buildAsyncClient()
messages
from a specific queue or subscription.ServiceBusReceiverAsyncClient
that receives messages from a queue or subscription.IllegalStateException
- if queueName
or topicName
are not set or, both of these fields are set. It is also thrown if the Service Bus connectionString
contains an EntityPath
that does not match one set in
queueName
or topicName
. Lastly, if a topicName
is set, but subscriptionName
is not.IllegalArgumentException
- Queue or topic name are not set via queueName()
or topicName()
, respectively.public ServiceBusReceiverClient buildClient()
messages
from a specific queue or subscription.ServiceBusReceiverClient
that receives messages from a queue or subscription.IllegalStateException
- if queueName
or topicName
are not set or, both of these fields are set. It is also thrown if the Service Bus connectionString
contains an EntityPath
that does not match one set in
queueName
or topicName
. Lastly, if a topicName
is set, but subscriptionName
is not.IllegalArgumentException
- Queue or topic name are not set via queueName()
or topicName()
, respectively.Copyright © 2021 Microsoft Corporation. All rights reserved.