public class EventHubConsumerOptions extends Object implements Cloneable
EventHubConsumerClient or an
EventHubConsumerAsyncClient to configure its behavior.| Constructor and Description |
|---|
EventHubConsumerOptions()
Creates a new instance with the default prefetch amount.
|
| Modifier and Type | Method and Description |
|---|---|
EventHubConsumerOptions |
clone()
Creates a shallow clone of this instance.
|
Long |
getOwnerLevel()
Gets the owner level for this consumer.
|
int |
getPrefetchCount()
Gets the count used by the consumer to control the number of events this receiver will actively receive and queue
locally without regard to whether a receive operation is currently active.
|
boolean |
getTrackLastEnqueuedEventProperties()
Gets whether or not the consumer should request information on the last enqueued event on its associated
partition, and track that information as events are received.
|
EventHubConsumerOptions |
setOwnerLevel(Long priority)
Sets the
ownerLevel value on this consumer. |
EventHubConsumerOptions |
setPrefetchCount(int prefetchCount)
Sets the count used by the receiver to control the number of events this receiver will actively receive and queue
locally without regard to whether a receive operation is currently active.
|
EventHubConsumerOptions |
setTrackLastEnqueuedEventProperties(boolean trackLastEnqueuedEventProperties)
Sets whether or not the consumer should request information on the last enqueued event on its associated
partition, and track that information as events are received.
|
public EventHubConsumerOptions()
public EventHubConsumerOptions setOwnerLevel(Long priority)
ownerLevel value on this consumer. When populated, the level indicates that a consumer is
intended to be the only reader of events for the requested partition and an associated consumer group. To do so,
this consumer will attempt to assert ownership over the partition; in the case where more than one exclusive
consumer attempts to assert ownership for the same partition/consumer group pair, the one having a larger EventHubConsumerOptions.getOwnerLevel() value will "win".
When an exclusive consumer is used, those consumers 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.
priority - The priority associated with an exclusive consumer; for a non-exclusive consumer, this
value should be null.EventHubConsumerOptions object.IllegalArgumentException - if priority is not null and is less than 0.public EventHubConsumerOptions setPrefetchCount(int prefetchCount)
prefetchCount - The amount of events to queue locally.EventHubConsumerOptions object.IllegalArgumentException - if prefetchCount is less than the EventHubConsumerOptions.MINIMUM_PREFETCH_COUNT or greater than EventHubConsumerOptions.MAXIMUM_PREFETCH_COUNT.public EventHubConsumerOptions setTrackLastEnqueuedEventProperties(boolean trackLastEnqueuedEventProperties)
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.
trackLastEnqueuedEventProperties - true if the resulting consumer will keep track of the last
enqueued information for that partition; false otherwise.EventHubConsumerOptions object.public Long getOwnerLevel()
Optional.isPresent() is false, 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.public int getPrefetchCount()
public boolean getTrackLastEnqueuedEventProperties()
true if the resulting consumer will keep track of the last enqueued information for that
partition; false otherwise.public EventHubConsumerOptions clone()
Copyright © 2019 Microsoft Corporation. All rights reserved.