ReceiveOptions Class

  • java.lang.Object
    • com.azure.messaging.eventhubs.models.ReceiveOptions

public class ReceiveOptions

Set of options that can be specified when receiving events from an EventHubConsumerAsyncClient or EventHubConsumerClient.

Constructor Summary

Constructor Description
ReceiveOptions()

Creates a new instance.

Method Summary

Modifier and Type Method and Description
Long getOwnerLevel()

Gets the owner level for this consumer.

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.

ReceiveOptions setOwnerLevel(Long priority)

Sets the ownerLevel value on this receive operation.

ReceiveOptions 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.

Methods inherited from java.lang.Object

Constructor Details

ReceiveOptions

public ReceiveOptions()

Creates a new instance.

Method Details

getOwnerLevel

public Long getOwnerLevel()

Gets the owner level for this consumer. If the value is null, 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.

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.

setOwnerLevel

public ReceiveOptions setOwnerLevel(Long priority)

Sets the ownerLevel 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 larger getOwnerLevel() 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 be null.

Returns:

The updated ReceiveOptions object.

setTrackLastEnqueuedEventProperties

public ReceiveOptions 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.

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.

Applies to