public final class ReceiverOptions extends Object
PartitionReceiver.| Constructor and Description |
|---|
ReceiverOptions() |
| Modifier and Type | Method and Description |
|---|---|
String |
getIdentifier()
Gets the identifier of the
PartitionReceiver |
int |
getPrefetchCount()
Get Prefetch Count.
|
boolean |
getReceiverRuntimeMetricEnabled()
Knob to enable/disable runtime metric of the receiver.
|
void |
setIdentifier(String value)
Set an identifier to
PartitionReceiver. |
void |
setPrefetchCount(int prefetchCount)
Set the number of events that can be pre-fetched and cached at the
PartitionReceiver. |
void |
setReceiverRuntimeMetricEnabled(boolean value)
Knob to enable/disable runtime metric of the receiver.
|
public boolean getReceiverRuntimeMetricEnabled()
EventHubClient.createReceiver(java.lang.String, java.lang.String, com.microsoft.azure.eventhubs.EventPosition),
after the first PartitionReceiver.receive(int) call, PartitionReceiver.getRuntimeInformation() is populated.
Enabling this knob will add 3 additional properties to all EventData's received on the EventHubClient.createReceiver(java.lang.String, java.lang.String, com.microsoft.azure.eventhubs.EventPosition).
boolean indicating, whether, the runtime metric of the receiver was enabledpublic void setReceiverRuntimeMetricEnabled(boolean value)
EventHubClient.createReceiver(java.lang.String, java.lang.String, com.microsoft.azure.eventhubs.EventPosition),
after the first PartitionReceiver.receive(int) call, PartitionReceiver.getRuntimeInformation() and
PartitionReceiver.getEventPosition() will be populated.
This knob facilitates for an optimization where the Consumer of Event Hub has the end of stream details at the disposal,
without making any additional EventHubClient.getPartitionRuntimeInformation(String) call to Event Hubs service.
To achieve this, behind the scenes, along with the actual EventData, that the Event Hubs PartitionReceiver
delivers, it includes extra information about the Event Hubs partitions end of stream details on every event.
In summary, enabling this knob will
help users to save an extra call to Event Hubs service to fetch Event Hubs partition information and as a result, will add that information as
header to each EventData received by the client.
value - the boolean to indicate, whether, the runtime metric of the receiver should be enabledpublic String getIdentifier()
PartitionReceiverPartitionReceiver; null if nothing was setpublic void setIdentifier(String value)
PartitionReceiver.
This identifier will be used by EventHubs service when reporting any errors across receivers, and is caused by this receiver.
For example, when receiver quota limit is hit, while a user is trying to create New receiver,
EventHubs service will throw QuotaExceededException and will include this identifier.
So, its very critical to choose a value, which can uniquely identify the whereabouts of PartitionReceiver.
value - string to identify PartitionReceiverpublic int getPrefetchCount()
setPrefetchCount(int)public void setPrefetchCount(int prefetchCount)
throws EventHubException
PartitionReceiver.
By default the value is 500
prefetchCount - the number of events to pre-fetch. value must be between 1 and 2000.EventHubException - if setting prefetchCount encounters errorCopyright © 2019 Microsoft Corporation. All rights reserved.