/// <summary> /// The the upstream handler that this handler will forward messages to /// </summary> /// <param name="up">upstream handler</param> public void SetUpstream(UpstreamContext up) { if (up == null) { throw new ArgumentNullException("up"); } _up = up; }
/// <summary> /// Sets the next upstream handler that this one will forward messages to /// </summary> /// <param name="next">The next.</param> public void SetNext(UpstreamContext next) { if (next == null) { throw new ArgumentNullException("next"); } _next = next; }
/// <summary> /// Register a upstream handler. /// Upstream handlers should be registered from closest to the /// command handler and finally the application handler (which should receive the error messages) /// </summary> /// <param name="handler">The handler.</param> public void RegisterUpstream(IUpstreamHandler handler) { if (handler == null) throw new ArgumentNullException("handler"); var newContext = new UpstreamContext(handler); if (_upstreamHandlers.Count > 0) _upstreamHandlers[_upstreamHandlers.Count - 1].SetNext(newContext); _upstreamHandlers.Add(newContext); }
/// <summary> /// Add a new upstream handler (handles failures which was detected when the command was traveling down to the command handler) /// </summary> /// <param name="context">Context for the handler</param> public void Add(UpstreamContext context) { if (context == null) { throw new ArgumentNullException("context"); } if (_fixed) { throw new InvalidOperationException( "The pipeline may not be modified after Start() has been called."); } _upstream.Add(context); }
/// <summary> /// Register a upstream handler. /// Upstream handlers should be registered from closest to the /// command handler and finally the application handler (which should receive the error messages) /// </summary> /// <param name="handler">The handler.</param> public void RegisterUpstream(IUpstreamHandler handler) { if (handler == null) { throw new ArgumentNullException("handler"); } var newContext = new UpstreamContext(handler); if (_upstreamHandlers.Count > 0) { _upstreamHandlers[_upstreamHandlers.Count - 1].SetNext(newContext); } _upstreamHandlers.Add(newContext); }
public void DestinationIsNotSet() { var upContext = new UpstreamContext(new ForwardingUpHandler()); var destination = Substitute.For<IUpstreamHandler>(); var downHandler = Substitute.For<IDownstreamHandler>(); var downContext = new DownstreamContext(downHandler); var pipeline = new Decoupled.Pipeline.Pipeline(); var msg = Substitute.For<IUpstreamMessage>(); pipeline.Add(downContext); pipeline.Add(upContext); pipeline.Add(new UpstreamContext(destination)); pipeline.Start(); upContext.Invoke(msg); destination.Received().HandleUpstream(Arg.Any<IUpstreamContext>(), msg); }
/// <summary> /// Initializes a new instance of the <see cref="Pipeline" /> class. /// </summary> public Pipeline() { _myUpContext = new UpstreamContext(this); _myDownContext = new DownstreamContext(this); }
/// <summary> /// Add a new upstream handler (handles failures which was detected when the command was traveling down to the command handler) /// </summary> /// <param name="context">Context for the handler</param> public void Add(UpstreamContext context) { if (context == null) throw new ArgumentNullException("context"); if (_fixed) throw new InvalidOperationException( "The pipeline may not be modified after Start() has been called."); _upstream.Add(context); }
/// <summary> /// The the upstream handler that this handler will forward messages to /// </summary> /// <param name="up">upstream handler</param> public void SetUpstream(UpstreamContext up) { if (up == null) throw new ArgumentNullException("up"); _up = up; }
/// <summary> /// Sets the next upstream handler that this one will forward messages to /// </summary> /// <param name="next">The next.</param> public void SetNext(UpstreamContext next) { if (next == null) throw new ArgumentNullException("next"); _next = next; }