ReceiverOptions Class
- java.
lang. Object - com.
microsoft. azure. eventhubs. ReceiverOptions
- com.
public final class ReceiverOptions
Represents various optional behaviors which can be turned on or off during the creation of a PartitionReceiver.
Constructor Summary
Constructor | Description | |
---|---|---|
ReceiverOptions() |
Method Summary
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. |
Methods inherited from java.lang.Object
Constructor Details
ReceiverOptions
public ReceiverOptions()
Method Details
getIdentifier
public String getIdentifier()
Gets the identifier of the PartitionReceiver
Returns:
getPrefetchCount
public int getPrefetchCount()
Get Prefetch Count.
Returns:
getReceiverRuntimeMetricEnabled
public boolean getReceiverRuntimeMetricEnabled()
Knob to enable/disable runtime metric of the receiver. If this is set to true and is passed to EventHubClient#createReceiver, after the first receive(int maxEventCount) call, getRuntimeInformation() is populated.
Enabling this knob will add 3 additional properties to all EventData's received on the EventHubClient#createReceiver.
Returns:
setIdentifier
public void setIdentifier(String value)
Set an identifier to 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.
Parameters:
setPrefetchCount
public void setPrefetchCount(int prefetchCount)
Set the number of events that can be pre-fetched and cached at the PartitionReceiver.
By default the value is 500
Parameters:
Throws:
setReceiverRuntimeMetricEnabled
public void setReceiverRuntimeMetricEnabled(boolean value)
Knob to enable/disable runtime metric of the receiver. If this is set to true and is passed to EventHubClient#createReceiver, after the first receive(int maxEventCount) call, getRuntimeInformation() and 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 getPartitionRuntimeInformation(String partitionId) 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.
Parameters:
Applies to
Azure SDK for Java