Class ReceiveOptions
java.lang.Object
com.azure.messaging.eventhubs.models.ReceiveOptions
Set of options that can be specified when receiving events from an
EventHubConsumerAsyncClient
or
EventHubConsumerClient
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets the owner level for this consumer.boolean
Gets whether or not the receive operation should request information on the last enqueued event on its associated partition, and track that information as events are received.setOwnerLevel
(Long priority) Sets theownerLevel
value on this receive operation.setTrackLastEnqueuedEventProperties
(boolean trackLastEnqueuedEventProperties) Sets whether or not the receive operation should request information on the last enqueued event on its associated partition, and track that information as events are received.
-
Constructor Details
-
ReceiveOptions
public ReceiveOptions()
-
-
Method Details
-
getOwnerLevel
Gets the owner level for this consumer. If the value isnull
, then this is not an exclusive consumer. Otherwise, it is an exclusive consumer, and there can only be one active consumer for each partition and consumer group combination. The exclusive consumer is be based on which one has the higher owner level value.- Returns:
- The owner level for this receive operation. If the
null
, then this is not an exclusive consumer.
-
setOwnerLevel
Sets theownerLevel
value on this receive operation. When populated, the level indicates that the receive operation is intended to be the only reader of events for the requested partition and associated consumer group. To do so, this receive operation will attempt to assert ownership over the partition; in the case where there is more than one exclusive receive operation for the same partition/consumer group pair, the one having a largergetOwnerLevel()
value will "win".When an exclusive receive operation is used, those receive operations which are not exclusive or which have a lower priority will either not be allowed to be created. If they already exist, will encounter an exception during the next attempted operation.
- Parameters:
priority
- The priority associated with an exclusive receive operation; for a non-exclusive receive operation, this value should benull
.- Returns:
- The updated
ReceiveOptions
object. - Throws:
IllegalArgumentException
- ifpriority
is notnull
and is less than 0.
-
getTrackLastEnqueuedEventProperties
public boolean getTrackLastEnqueuedEventProperties()Gets whether or not the receive operation should request information on the last enqueued event on its associated partition, and track that information as events are received.- Returns:
true
if the resulting receive operation will keep track of the last enqueued information for that partition;false
otherwise.
-
setTrackLastEnqueuedEventProperties
Sets whether or not the receive operation should request information on the last enqueued event on its associated partition, and track that information as events are received.When information about the partition's last enqueued event is being tracked, each event received from the Event Hubs service will carry metadata about the partition that it otherwise would not. This results in a small amount of additional network bandwidth consumption that is generally a favorable trade-off when considered against periodically making requests for partition properties using the Event Hub client.
- Parameters:
trackLastEnqueuedEventProperties
-true
if the resulting events will keep track of the last enqueued information for that partition;false
otherwise.- Returns:
- The updated
ReceiveOptions
object.
-