EventProcessorOptions Class

  • java.lang.Object
    • com.microsoft.azure.eventprocessorhost.EventProcessorOptions

public class EventProcessorOptions

Constructor Summary

Constructor Description
EventProcessorOptions()

Method Summary

Modifier and Type Method and Description
EventProcessorOptions getDefaultOptions()
Function<String, EventPosition> getInitialPositionProvider()
Boolean getInvokeProcessorAfterReceiveTimeout()
int getMaxBatchSize()

Returns the maximum number of events that will be passed to one call to IEventProcessor.onEvents

int getPrefetchCount()
boolean getReceiverRuntimeMetricEnabled()

Knob to enable/disable runtime metric of the receiver. If this is set to true, the first parameter com.microsoft.azure.eventprocessorhost.PartitionContext#runtimeInformation of IEventProcessor#onEvents(com.microsoft.azure.eventprocessorhost.PartitionContext, java.lang.Iterable) will be populated.

Enabling this knob will add 3 additional properties to all raw AMQP events received.

Duration getReceiveTimeOut()

Returns the timeout for receive operations.

void setExceptionNotification(Consumer<ExceptionReceivedEventArgs> notificationHandler)

Sets a handler which receives notification of general exceptions.

Exceptions which occur while processing events from a particular Event Hub partition are delivered to the onError method of the event processor for that partition. This handler is called on occasions when there is no event processor associated with the throwing activity, or the event processor could not be created.

The handler is not expected to do anything about the exception. If it is possible to recover, the event processor host instance will recover automatically.

void setInitialPositionProvider(Function<String, EventPosition> initialPositionProvider)
void setInvokeProcessorAfterReceiveTimeout(Boolean invokeProcessorAfterReceiveTimeout)

Changes whether the EventProcessorHost will call IEventProcessor.onEvents() with an empty iterable when a receive timeout occurs (true) or not (false).

The default is false (no call).

void setMaxBatchSize(int maxBatchSize)

Sets the maximum number of events that will be passed to one call to IEventProcessor.onEvents

void setPrefetchCount(int prefetchCount)
void setReceiverRuntimeMetricEnabled(boolean value)

Knob to enable/disable runtime metric of the receiver. If this is set to true, the first parameter com.microsoft.azure.eventprocessorhost.PartitionContext#runtimeInformation of IEventProcessor#onEvents(com.microsoft.azure.eventprocessorhost.PartitionContext, java.lang.Iterable) will be populated.

Enabling this knob will add 3 additional properties to all raw AMQP events received.

void setReceiveTimeOut(Duration receiveTimeOut)

Sets the timeout for receive operations.

Constructor Details

EventProcessorOptions

public EventProcessorOptions()

Method Details

getDefaultOptions

public static EventProcessorOptions getDefaultOptions()

getInitialPositionProvider

public Function getInitialPositionProvider()

getInvokeProcessorAfterReceiveTimeout

public Boolean getInvokeProcessorAfterReceiveTimeout()

getMaxBatchSize

public int getMaxBatchSize()

Returns the maximum number of events that will be passed to one call to IEventProcessor.onEvents

Returns:

the maximum maximum number of events that will be passed to one call to IEventProcessor.onEvents

getPrefetchCount

public int getPrefetchCount()

getReceiverRuntimeMetricEnabled

public boolean getReceiverRuntimeMetricEnabled()

Knob to enable/disable runtime metric of the receiver. If this is set to true, the first parameter com.microsoft.azure.eventprocessorhost.PartitionContext#runtimeInformation of IEventProcessor#onEvents(com.microsoft.azure.eventprocessorhost.PartitionContext, java.lang.Iterable) will be populated.

Enabling this knob will add 3 additional properties to all raw AMQP events received.

Returns:

the boolean indicating, whether, the runtime metric of the receiver was enabled

getReceiveTimeOut

public Duration getReceiveTimeOut()

Returns the timeout for receive operations.

Returns:

the timeout for receive operations

setExceptionNotification

public void setExceptionNotification(Consumer notificationHandler)

Sets a handler which receives notification of general exceptions.

Exceptions which occur while processing events from a particular Event Hub partition are delivered to the onError method of the event processor for that partition. This handler is called on occasions when there is no event processor associated with the throwing activity, or the event processor could not be created.

The handler is not expected to do anything about the exception. If it is possible to recover, the event processor host instance will recover automatically.

Parameters:

notificationHandler - Handler which is called when an exception occurs. Set to null to stop handling.

setInitialPositionProvider

public void setInitialPositionProvider(Function initialPositionProvider)

Parameters:

initialPositionProvider

setInvokeProcessorAfterReceiveTimeout

public void setInvokeProcessorAfterReceiveTimeout(Boolean invokeProcessorAfterReceiveTimeout)

Changes whether the EventProcessorHost will call IEventProcessor.onEvents() with an empty iterable when a receive timeout occurs (true) or not (false).

The default is false (no call).

Parameters:

invokeProcessorAfterReceiveTimeout - the new value for what to do

setMaxBatchSize

public void setMaxBatchSize(int maxBatchSize)

Sets the maximum number of events that will be passed to one call to IEventProcessor.onEvents

Parameters:

maxBatchSize - the maximum number of events that will be passed to one call to IEventProcessor.onEvents

setPrefetchCount

public void setPrefetchCount(int prefetchCount)

Parameters:

prefetchCount

setReceiverRuntimeMetricEnabled

public void setReceiverRuntimeMetricEnabled(boolean value)

Knob to enable/disable runtime metric of the receiver. If this is set to true, the first parameter com.microsoft.azure.eventprocessorhost.PartitionContext#runtimeInformation of IEventProcessor#onEvents(com.microsoft.azure.eventprocessorhost.PartitionContext, java.lang.Iterable) will be populated.

Enabling this knob will add 3 additional properties to all raw AMQP events received.

Parameters:

value - the boolean to indicate, whether, the runtime metric of the receiver should be enabled

setReceiveTimeOut

public void setReceiveTimeOut(Duration receiveTimeOut)

Sets the timeout for receive operations.

Parameters:

receiveTimeOut - new timeout for receive operations

Applies to