/// <summary>
        ///  p>Create a group of event handlers to be used as a dependency.
        /// For example if the handler <code>A</code> must process events before handler <code>B</code>:</p>
        ///
        /// <pre><code>dw.after(A).HandleEventsWith(B);</code></pre>
        /// </summary>
        /// <param name="handlers">the event handlers, previously set up with {@link #HandleEventsWith(com.lmax.disruptor.EventHandler[])},that will form the barrier for subsequent handlers or processors.</param>
        /// <returns>an <see cref="EventHandlerGroup"/>that can be used to setup a dependency barrier over the specified event handlers.</returns>
        public EventHandlerGroup <T> After(params IEventHandler <T>[] handlers)
        {
            var sequences = new Sequence[handlers.Length];

            for (int i = 0, handlersLength = handlers.Length; i < handlersLength; i++)
            {
                sequences[i] = consumerRepository.GetSequenceFor(handlers[i]);
            }

            return(new EventHandlerGroup <T>(this, consumerRepository, sequences));
        }
Пример #2
0
 /// <summary>
 /// Create a group of event handlers to be used as a dependency.
 /// For example if the handler <code>A</code> must process events before handler <code>B</code>:
 /// <code>dw.After(A).HandleEventsWith(B);</code>
 /// </summary>
 /// <param name="handlers">handlers the event handlers, previously set up with <see cref="HandleEventsWith(IValueEventHandler{T}[])"/>,
 /// that will form the barrier for subsequent handlers or processors.</param>
 /// <returns>an <see cref="ValueEventHandlerGroup{T}"/> that can be used to setup a dependency barrier over the specified event handlers.</returns>
 public ValueEventHandlerGroup <T> After(params IValueEventHandler <T>[] handlers)
 {
     return(new ValueEventHandlerGroup <T>(this, _consumerRepository, handlers.Select(h => _consumerRepository.GetSequenceFor(h))));
 }
Пример #3
0
        /// <summary>
        /// Create a group of event handlers to be used as a dependency.
        /// For example if the handler <code>A</code> must process events before handler <code>B</code>:
        /// <code>dw.After(A).HandleEventsWith(B);</code>
        /// </summary>
        /// <param name="handlers">the event handlers, previously set up with <see cref="HandleEventsWith(Disruptor.IEventHandler{T}[])"/>, that will form the barrier for subsequent handlers or processors.</param>
        /// <returns>an <see cref="EventHandlerGroup{T}"/> that can be used to setup a dependency barrier over the specified event handlers.</returns>
        public EventHandlerGroup <T> After(params IEventHandler <T>[] handlers)
        {
            var sequences = handlers.Select(it => _consumerRepository.GetSequenceFor(it));

            return(new EventHandlerGroup <T>(this, _consumerRepository, sequences));
        }