/// <summary>
 /// Initializes a new instance of the <see cref="EventPipelineBuilder" /> class.
 /// </summary>
 /// <param name="errorHandler">Your upstream handle which will receive and take care of all error messages (which are defined in <c>Griffin.Decoupled.DomainEvents.Pipeline.Messages</c>).</param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public EventPipelineBuilder(IUpstreamHandler errorHandler)
 {
     if (errorHandler == null)
     {
         throw new ArgumentNullException("errorHandler");
     }
     _errorHandler = errorHandler;
 }
        /// <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);
        }
예제 #3
0
        /// <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);
        }
예제 #4
0
        /// <summary>
        /// Add a new upstream handler
        /// </summary>
        /// <param name="handler">Handler to add</param>
        /// <remarks>Upstream handlers takes care of everything sent from the channel to the client.</remarks>
        public void AddUpstreamHandler(IUpstreamHandler handler)
        {
            var ctx  = new PipelineUpstreamContext(this, handler);
            var last = _upstreamContexts.Last;

            if (last != null)
            {
                _logger.Debug("Added upstream handler " + handler + " and linked it as next handler for " + last.Value);
                last.Value.NextHandler = ctx;
            }
            else
            {
                _logger.Debug("Added upstream handler " + handler);
            }


            _upstreamContexts.AddLast(ctx);
        }
예제 #5
0
        /// <summary>
        /// Add a new upstream handler 
        /// </summary>
        /// <param name="handler">Handler to add</param>
        /// <remarks>Upstream handlers takes care of everything sent from the channel to the client.</remarks>
        public void AddUpstreamHandler(IUpstreamHandler handler)
        {
            var ctx = new PipelineUpstreamContext(this, handler);
            var last = _upstreamContexts.Last;
            if (last != null)
            {
                _logger.Debug("Added upstream handler " + handler + " and linked it as next handler for " + last.Value);
                last.Value.NextHandler = ctx;
            }
            else
            {
                _logger.Debug("Added upstream handler " + handler);
            }


            _upstreamContexts.AddLast(ctx);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EventPipelineBuilder" /> class.
 /// </summary>
 /// <param name="errorHandler">Your upstream handle which will receive and take care of all error messages (which are defined in <c>Griffin.Decoupled.DomainEvents.Pipeline.Messages</c>).</param>
 /// <exception cref="System.ArgumentNullException"></exception>
 public EventPipelineBuilder(IUpstreamHandler errorHandler)
 {
     if (errorHandler == null) throw new ArgumentNullException("errorHandler");
     _errorHandler = errorHandler;
 }
 public PipelineUpstreamContext(IPipeline pipeline, IUpstreamHandler myHandler)
 {
     _pipeline = pipeline;
     _myHandler = myHandler;
 }
 public PipelineUpstreamContext(IPipeline pipeline, IUpstreamHandler myHandler)
 {
     _pipeline  = pipeline;
     _myHandler = myHandler;
 }
예제 #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpstreamContext" /> class.
 /// </summary>
 /// <param name="mine">The handler that this context is for.</param>
 public UpstreamContext(IUpstreamHandler mine)
 {
     _mine = mine;
 }
 public PipelineUpstreamContext(IPipeline pipeline, IUpstreamHandler myHandler)
 {
     this.pipeline  = pipeline;
     this.myHandler = myHandler;
 }
예제 #11
0
 public FreeSwitchPipeline(SecureString password, IUpstreamHandler client)
 {
     _password = password;
     _client   = client;
 }
예제 #12
0
 /// <summary>
 /// Add an handler instance (singleton)
 /// </summary>
 /// <param name="handler">Must implement <see cref="IDownstreamHandler"/> and/or <see cref="IUpstreamHandler"/></param>
 /// <remarks>Same instance will be used for all channels. Use the <see cref="IPipelineHandlerContext"/> to store any context information.</remarks>
 public void AddUpstreamHandler(IUpstreamHandler handler)
 {
     this.uptreamHandlers.AddLast(new HandlerInformation <IUpstreamHandler>(handler));
 }
예제 #13
0
 public void RegisterUpstreamHandler(IUpstreamHandler handler)
 {
     if (handler == null)
         throw new ArgumentNullException("handler");
     _upstreamHandlers.AddLast(handler);
 }
예제 #14
0
 /// <summary>
 /// Send an event upstream (from channels to application)
 /// </summary>
 /// <param name="handlerToStartFrom">Handler that should be invoked</param>
 /// <param name="channelEvent">Event to send</param>
 public void SendUpstream(IUpstreamHandler handlerToStartFrom, IChannelEvent channelEvent)
 {
     ChannelHandlerContext ctx = _contexts[handlerToStartFrom];
     handlerToStartFrom.HandleUpstream(ctx, channelEvent);
 }
예제 #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UpstreamContext" /> class.
 /// </summary>
 /// <param name="mine">The handler that this context is for.</param>
 public UpstreamContext(IUpstreamHandler mine)
 {
     _mine = mine;
 }