/// <summary> /// Specify the <see cref="IExceptionHandler{TEvent}"/> to use with the event handler. /// </summary> /// <param name="exceptionHandler">the exception handler to use.</param> public void With(IExceptionHandler <T> exceptionHandler) { var eventProcessor = _consumerRepository.GetEventProcessorFor(_eventHandler); if (eventProcessor is IBatchEventProcessor <T> batchEventProcessor) { batchEventProcessor.SetExceptionHandler(exceptionHandler); _consumerRepository.GetBarrierFor(_eventHandler).Alert(); } else { throw new RuntimeException( "EventProcessor: " + eventProcessor + " is not a BatchEventProcessor " + "and does not support exception handlers."); } }
/// <summary> /// Get the <see cref="ISequenceBarrier"/> used by a specific handler. Note that the <see cref="ISequenceBarrier"/> /// may be shared by multiple event handlers. /// </summary> /// <param name="handler">the handler to get the barrier for</param> /// <returns>the SequenceBarrier used by the given handler</returns> public ISequenceBarrier GetBarrierFor(IValueEventHandler <T> handler) => _consumerRepository.GetBarrierFor(handler);
/// <summary> /// Get the <see cref="ISequenceBarrier"/> used by a specific handler. Note that the <see cref="ISequenceBarrier"/> may be shared by multiple event handlers. /// </summary> /// <param name="handler"></param> /// <returns></returns> public ISequenceBarrier GetBarrierFor(IEventHandler <T> handler) { return(_consumerRepository.GetBarrierFor(handler)); }