/// <summary> /// Create a group of event processors to be used as a dependency. /// </summary> /// <param name="processors">the event processors, previously set up with <see cref="HandleEventsWith(Disruptor.IEventProcessor[]) "/>, that will form the barrier for subsequent handlers or processors.</param> /// <returns>an <see cref="EventHandlerGroup{T}"/> that can be used to setup a {@link SequenceBarrier} over the specified event processors.</returns> public EventHandlerGroup <T> After(params IEventProcessor[] processors) { foreach (var processor in processors) { _consumerRepository.Add(processor); } return(new EventHandlerGroup <T>(this, _consumerRepository, SequenceGroupManager.GetSequencesFor(processors))); }
/// <summary> /// Set up custom event processors to handle events from the ring buffer. The Disruptor will automatically start these processors when <see cref="StartAsync"/> 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) { if (processors == null) { return(null); } foreach (var processor in processors) { _consumerRepository.Add(processor); } var sequences = new ISequence[processors.Length]; for (var i = 0; i < processors.Length; i++) { sequences[i] = processors[i].GetSequence(); } _ringBuffer.AddGatingSequences(sequences); return(new EventHandlerGroup <T>(this, _consumerRepository, SequenceGroupManager.GetSequencesFor(processors))); }