/// <summary> /// Set up custom <see cref="IEventProcessor"/> to handle events from the ring buffer. The Disruptor will /// automatically start those processors when <see cref="Disruptor{T}.Start"/> is called. /// </summary> /// <param name="processors">the event processors that will process events.</param> /// <returns>a <see cref="EventHandlerGroup{T}"/> that can be used to chain dependencies.</returns> public EventHandlerGroup <T> HandleEventsWith(params IEventProcessor[] processors) { foreach (var eventProcessor in processors) { _eventProcessorRepository.Add(eventProcessor); } return(new EventHandlerGroup <T>(this, _eventProcessorRepository, processors)); }
/// <summary> /// Create a new <see cref="EventHandlerGroup{T}"/> that combines the handlers in this group with input processors. /// </summary> /// <param name="processors">the processors to combine.</param> /// <returns>a new <see cref="EventHandlerGroup{T}"/> combining the existing and new processors into a single dependency group.</returns> public EventHandlerGroup <T> And(params IEventProcessor[] processors) { var combinedProcessors = processors.Concat(_eventProcessors).ToArray(); foreach (var eventProcessor in processors) { _eventProcessorRepository.Add(eventProcessor); } return(new EventHandlerGroup <T>(_disruptor, _eventProcessorRepository, combinedProcessors)); }