Class EventProcessorOptions


  • public final class EventProcessorOptions
    extends Object
    Options affecting the behavior of the event processor host instance in general.
    • Constructor Detail

      • EventProcessorOptions

        public EventProcessorOptions()
    • Method Detail

      • getDefaultOptions

        public static EventProcessorOptions getDefaultOptions()
        Returns an EventProcessorOptions instance with all options set to the default values. The default values are:
         MaxBatchSize: 10
         ReceiveTimeOut: 1 minute
         PrefetchCount: 300
         InitialPositionProvider: uses the last checkpoint, or START_OF_STREAM
         InvokeProcessorAfterReceiveTimeout: false
         ReceiverRuntimeMetricEnabled: false
         
        Returns:
        an EventProcessorOptions instance with all options set to the default values
      • setExceptionNotification

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

        Parameters:
        notificationHandler - Handler which is called when an exception occurs. Set to null to stop handling.
      • 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
      • 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
      • getReceiveTimeOut

        public Duration getReceiveTimeOut()
        Returns the timeout for receive operations.
        Returns:
        the timeout for receive operations
      • setReceiveTimeOut

        public void setReceiveTimeOut​(Duration receiveTimeOut)
        Sets the timeout for receive operations.
        Parameters:
        receiveTimeOut - new timeout for receive operations
      • getPrefetchCount

        public int getPrefetchCount()
        Returns the current prefetch count for the underlying event hub client.
        Returns:
        the current prefetch count for the underlying client
      • setPrefetchCount

        public void setPrefetchCount​(int prefetchCount)
        Sets the prefetch count for the underlying event hub client. The default is 300. This controls how many events are received in advance.
        Parameters:
        prefetchCount - The new prefetch count.
      • getInitialPositionProvider

        public Function<String,​EventPosition> getInitialPositionProvider()
        If there is no checkpoint for a partition, the initialPositionProvider function is used to determine the position at which to start receiving events for that partition.
        Returns:
        the current initial position provider function
      • setInitialPositionProvider

        public void setInitialPositionProvider​(Function<String,​EventPosition> initialPositionProvider)
        Sets the function used to determine the position at which to start receiving events for a partition if there is no checkpoint for that partition. The provider function takes one argument, the partition id (a String), and returns the desired position.
        Parameters:
        initialPositionProvider - The new provider function.
      • getInvokeProcessorAfterReceiveTimeout

        public Boolean getInvokeProcessorAfterReceiveTimeout()
        Returns whether the EventProcessorHost will call IEventProcessor.onEvents() with an empty iterable when a receive timeout occurs (true) or not (false). Defaults to false.
        Returns:
        true if EventProcessorHost will call IEventProcessor.OnEvents on receive timeout, false otherwise
      • 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