public final class ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder extends Object
ServiceBusReceiverClient
and ServiceBusReceiverAsyncClient
to consume
messages from a session aware Service Bus entity.Modifier and Type | Method and Description |
---|---|
ServiceBusSessionReceiverAsyncClient |
buildAsyncClient()
Creates an asynchronous, session-aware Service Bus receiver responsible for reading
messages from a specific queue or subscription. |
ServiceBusSessionReceiverClient |
buildClient()
Creates a synchronous, session-aware Service Bus receiver responsible for reading
messages from a specific queue or subscription. |
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
disableAutoComplete()
Disables auto-complete and auto-abandon of received messages.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
maxAutoLockRenewDuration(Duration maxAutoLockRenewDuration)
Sets the amount of time to continue auto-renewing the session lock.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
prefetchCount(int prefetchCount)
Sets the prefetch count of the receiver.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
queueName(String queueName)
Sets the name of the queue to create a receiver for.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
receiveMode(ServiceBusReceiveMode receiveMode)
Sets the receive mode for the receiver.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
subscriptionName(String subscriptionName)
Sets the name of the subscription in the topic to listen to.
|
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder |
topicName(String topicName)
Sets the name of the topic.
|
public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder disableAutoComplete()
completed
. If an error happens when
the message is processed, it is abandoned
.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder 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 session lock.
Duration.ZERO
or null
indicates that auto-renewal is disabled.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.IllegalArgumentException
- If {code maxAutoLockRenewDuration} is negative.public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder 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.ServiceBusSessionReceiverClientBuilder
object.IllegalArgumentException
- If {code prefetchCount} is negative.public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder queueName(String queueName)
queueName
- Name of the queue.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder receiveMode(ServiceBusReceiveMode receiveMode)
receiveMode
- Mode for receiving messages.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder subscriptionName(String subscriptionName)
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder.topicName(String)
must also be set.
subscriptionName
- Name of the subscription.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.A topic name should be set as well.
public ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder topicName(String topicName)
ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder.subscriptionName(String)
must also be set.topicName
- Name of the topic.ServiceBusClientBuilder.ServiceBusSessionReceiverClientBuilder
object.A subscription name should be set as well.
public ServiceBusSessionReceiverAsyncClient buildAsyncClient()
messages
from a specific queue or subscription.ServiceBusSessionReceiverAsyncClient
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 ServiceBusSessionReceiverClient 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.