Ejemplo n.º 1
0
        /// <summary>
        /// Creates the specified input gateway.
        /// </summary>
        /// <typeparam name="TMessage">The type of the message.</typeparam>
        /// <param name="inputGateway">The input gateway.</param>
        /// <param name="handlerRepository">The handler repository.</param>
        /// <returns></returns>
        public static Listener <TMessage> Create <TMessage>(IInputGateway <TMessage, MessageHeader> inputGateway, IHandlerRepository handlerRepository) where TMessage : IMessage
        {
            var listener = new Listener <TMessage>(inputGateway, handlerRepository);

            listener.Logger = LoggerManager.Instance;
            return(listener);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ControlProcessor"/> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="outputGateway">The output gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="messageBuilder">The message builder.</param>
 /// <param name="reinjectionEngine">The reinjection engine.</param>
 internal ControlProcessor(Identification identification,
                           IInputGateway <IControlMessage, MessageHeader> inputGateway,
                           IOutputGateway <IControlMessage> outputGateway,
                           IHandlerRepository handlerRepository, IMessageBuilder messageBuilder, IReinjectionEngine reinjectionEngine)
     : base(identification, inputGateway, handlerRepository, messageBuilder, reinjectionEngine)
 {
     OutputGateway = outputGateway;
 }
Ejemplo n.º 3
0
 internal Listener(IInputGateway <TMessage, MessageHeader> inputGateway,
                   IHandlerRepository handlerRepository)
 {
     _inputGateway            = inputGateway;
     _inputGateway.OnMessage += MessageReceived;
     _handlerRepository       = handlerRepository;
     ConfigureStateMachine();
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates the input.
 /// </summary>
 /// <returns></returns>
 private ListenerConfigurator CreateInput()
 {
     var uri = new Uri(_listenerConfig.Input.Uri);
     _input = AgentGatewayFactory.CreateInputGateway<IMessage>(uri, _listenerConfig.Input.Transport,
                                                                         _listenerConfig.NumberOfParallelTasks,
                                                                         _listenerConfig.MaxReijections);
     return this;
 }
Ejemplo n.º 5
0
 private RouterProcessorConfigurator LoadHelpers()
 {
     var uri = new Uri(_hermEsbConfig.RouterProcessor.Input.Uri);
     _input = RouterGatewayFactory.CreateInputGateway(uri,
                                                     _hermEsbConfig.RouterProcessor.Input.Transport,
                                                     _hermEsbConfig.RouterProcessor.NumberOfParallelTasks,
                                                     _hermEsbConfig.RouterProcessor.MaxReijections);
     return this;
 }
Ejemplo n.º 6
0
 /// <summary>
 ///     Creates the router processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="routerOutputHelper">The router output helper.</param>
 /// <returns></returns>
 public static IProcessor CreateRouterProcessor(Identification identification,
                                                IInputGateway<byte[], RouterHeader> inputGateway,
                                                IRouterOutputHelper routerOutputHelper)
 {
     return new RouterProcessor(identification, inputGateway, routerOutputHelper)
         {
             Logger = LoggerManager.Instance
         };
 }
Ejemplo n.º 7
0
 /// <summary>
 ///     Creates the router processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="routerOutputHelper">The router output helper.</param>
 /// <returns></returns>
 public static IProcessor CreateRouterProcessor(Identification identification,
                                                IInputGateway <byte[], RouterHeader> inputGateway,
                                                IRouterOutputHelper routerOutputHelper)
 {
     return(new RouterProcessor(identification, inputGateway, routerOutputHelper)
     {
         Logger = LoggerManager.Instance
     });
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Creates the input.
        /// </summary>
        /// <returns></returns>
        private ListenerConfigurator CreateInput()
        {
            var uri = new Uri(_listenerConfig.Input.Uri);

            _input = AgentGatewayFactory.CreateInputGateway <IMessage>(uri, _listenerConfig.Input.Transport,
                                                                       _listenerConfig.NumberOfParallelTasks,
                                                                       _listenerConfig.MaxReijections);
            return(this);
        }
        private RouterProcessorConfigurator LoadHelpers()
        {
            var uri = new Uri(_hermEsbConfig.RouterProcessor.Input.Uri);

            _input = RouterGatewayFactory.CreateInputGateway(uri,
                                                             _hermEsbConfig.RouterProcessor.Input.Transport,
                                                             _hermEsbConfig.RouterProcessor.NumberOfParallelTasks,
                                                             _hermEsbConfig.RouterProcessor.MaxReijections);
            return(this);
        }
Ejemplo n.º 10
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="RouterProcessor" /> class.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="inputGateway">The message receiver.</param>
        /// <param name="routerOutputHelper">The bus sender helper.</param>
        internal RouterProcessor(Identification identification, IInputGateway <byte[], RouterHeader> inputGateway,
                                 IRouterOutputHelper routerOutputHelper)
        {
            JoinedBusInfo = BusInfo.Create();

            ConfigureStateMachine();
            _inputGateway            = inputGateway;
            _identification          = identification;
            _routerOutputHelper      = routerOutputHelper;
            _inputGateway.OnMessage += MessageReceived;
            _stateMachine.ChangeState(ProcessorStatus.Configured);
            _serializer = new JsonDataContractSerializer();
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     Creates the input.
        /// </summary>
        /// <returns></returns>
        private RouterControlConfigurator CreateInput()
        {
            var uri = new Uri(_hermEsbConfig.RouterControlProcessor.Input.Uri);
            _input = AgentGatewayFactory.CreateInputGateway<IControlMessage>(uri,
                                                                             _hermEsbConfig.RouterControlProcessor
                                                                                             .Input.Transport,
                                                                             _hermEsbConfig.RouterControlProcessor
                                                                                             .NumberOfParallelTasks,
                                                                             _hermEsbConfig.RouterControlProcessor
                                                                                             .MaxReijections);

            return this;
        }
Ejemplo n.º 12
0
        /// <summary>
        ///     Creates the router control processor.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="inputGateway">The input gateway.</param>
        /// <param name="handlerRepository">The handler repository.</param>
        /// <param name="subscriptorsHelper">The subscriptors helper.</param>
        /// <returns></returns>
        public static IController CreateRouterControlProcessor(Identification identification,
                                                               IInputGateway <IControlMessage, MessageHeader> inputGateway,
                                                               IHandlerRepository handlerRepository,
                                                               ISubscriptorsHelper subscriptorsHelper)
        {
            IMessageBuilder defaultObjectBuilder = MessageBuilderFactory.CreateDefaultBuilder();

            return(new RouterControlProcessor(identification, inputGateway, handlerRepository, subscriptorsHelper,
                                              defaultObjectBuilder)
            {
                Logger = LoggerManager.Instance
            });
        }
Ejemplo n.º 13
0
 /// <summary>
 ///     Creates the service processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="messageBuilder">The message builder.</param>
 /// <returns></returns>
 public static IProcessor CreateServiceProcessor(Identification identification,
                                                 IInputGateway <IMessage, MessageHeader> inputGateway,
                                                 IHandlerRepository handlerRepository,
                                                 IMessageBuilder messageBuilder)
 {
     return(new ServiceProcessor(identification,
                                 inputGateway,
                                 handlerRepository,
                                 messageBuilder, ReinjectionEngineFactory.CreateDefaultEngine(inputGateway))
     {
         Logger = LoggerManager.Instance
     });
 }
Ejemplo n.º 14
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="RouterProcessor" /> class.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="inputGateway">The message receiver.</param>
        /// <param name="routerOutputHelper">The bus sender helper.</param>
        internal RouterProcessor(Identification identification, IInputGateway<byte[], RouterHeader> inputGateway,
                                 IRouterOutputHelper routerOutputHelper)
        {
            JoinedBusInfo = BusInfo.Create();

            ConfigureStateMachine();
            _inputGateway = inputGateway;
            _identification = identification;
            _routerOutputHelper = routerOutputHelper;
            _inputGateway.OnMessage += MessageReceived;
            _stateMachine.ChangeState(ProcessorStatus.Configured);
            _serializer = new JsonDataContractSerializer();
        }
Ejemplo n.º 15
0
        /// <summary>
        ///     Creates the router control processor.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="inputGateway">The input gateway.</param>
        /// <param name="handlerRepository">The handler repository.</param>
        /// <param name="subscriptorsHelper">The subscriptors helper.</param>
        /// <returns></returns>
        public static IController CreateRouterControlProcessor(Identification identification,
                                                               IInputGateway<IControlMessage, MessageHeader> inputGateway,
                                                               IHandlerRepository handlerRepository,
                                                               ISubscriptorsHelper subscriptorsHelper)
        {
            IMessageBuilder defaultObjectBuilder = MessageBuilderFactory.CreateDefaultBuilder();

            return new RouterControlProcessor(identification, inputGateway, handlerRepository, subscriptorsHelper,
                                              defaultObjectBuilder)
                {
                    Logger = LoggerManager.Instance
                };
        }
        /// <summary>
        ///     Creates the input.
        /// </summary>
        /// <returns></returns>
        private RouterControlConfigurator CreateInput()
        {
            var uri = new Uri(_hermEsbConfig.RouterControlProcessor.Input.Uri);

            _input = AgentGatewayFactory.CreateInputGateway <IControlMessage>(uri,
                                                                              _hermEsbConfig.RouterControlProcessor
                                                                              .Input.Transport,
                                                                              _hermEsbConfig.RouterControlProcessor
                                                                              .NumberOfParallelTasks,
                                                                              _hermEsbConfig.RouterControlProcessor
                                                                              .MaxReijections);

            return(this);
        }
Ejemplo n.º 17
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RouterControlProcessor" /> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="subscriptonsHelper">The subscriptors helper.</param>
 /// <param name="messageBuilder">The message builder.</param>
 internal RouterControlProcessor(Identification identification,
                                 IInputGateway <IControlMessage, MessageHeader> inputGateway,
                                 IHandlerRepository handlerRepository,
                                 ISubscriptorsHelper subscriptonsHelper,
                                 IMessageBuilder messageBuilder)
 {
     ConfigureStateMachine();
     _identification                = identification;
     _inputGateway                  = inputGateway;
     _inputGateway.OnMessage       += MessageReceived;
     _handlerRepository             = handlerRepository;
     _subscriptonsHelper            = subscriptonsHelper;
     _subscriptonsHelper.Controller = this;
     _messageBuilder                = messageBuilder;
 }
Ejemplo n.º 18
0
 /// <summary>
 ///     Creates the control processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="outputGateway">The output gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <returns></returns>
 public static IController CreateControlProcessor(Identification identification,
                                                  IInputGateway<IControlMessage, MessageHeader> inputGateway,
                                                  IOutputGateway<IControlMessage> outputGateway,
                                                  IHandlerRepository handlerRepository)
 {
     return new ControlProcessor(identification,
                                 inputGateway,
                                 outputGateway,
                                 handlerRepository,
                                 MessageBuilderFactory.CreateDefaultBuilder(),
                                 ReinjectionEngineFactory.CreateDefaultEngine(inputGateway))
         {
             Logger = LoggerManager.Instance
         };
 }
Ejemplo n.º 19
0
 /// <summary>
 ///     Creates the control processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="outputGateway">The output gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <returns></returns>
 public static IController CreateControlProcessor(Identification identification,
                                                  IInputGateway <IControlMessage, MessageHeader> inputGateway,
                                                  IOutputGateway <IControlMessage> outputGateway,
                                                  IHandlerRepository handlerRepository)
 {
     return(new ControlProcessor(identification,
                                 inputGateway,
                                 outputGateway,
                                 handlerRepository,
                                 MessageBuilderFactory.CreateDefaultBuilder(),
                                 ReinjectionEngineFactory.CreateDefaultEngine(inputGateway))
     {
         Logger = LoggerManager.Instance
     });
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RouterControlProcessor" /> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="subscriptonsHelper">The subscriptors helper.</param>
 /// <param name="messageBuilder">The message builder.</param>
 internal RouterControlProcessor(Identification identification,
                                 IInputGateway<IControlMessage, MessageHeader> inputGateway,
                                 IHandlerRepository handlerRepository,
                                 ISubscriptorsHelper subscriptonsHelper,
                                 IMessageBuilder messageBuilder)
 {
     ConfigureStateMachine();
     _identification = identification;
     _inputGateway = inputGateway;
     _inputGateway.OnMessage += MessageReceived;
     _handlerRepository = handlerRepository;
     _subscriptonsHelper = subscriptonsHelper;
     _subscriptonsHelper.Controller = this;
     _messageBuilder = messageBuilder;
 }
Ejemplo n.º 21
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="Agent{TMessage}" /> class.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="inputGateway">The input gateway.</param>
        /// <param name="handlerRepository">The handler repository.</param>
        /// <param name="messageBuilder">The message builder.</param>
        /// <param name="reinjectionEngine">The reinjection engine.</param>
        protected Agent(Identification identification,
                        IInputGateway <TMessage, MessageHeader> inputGateway,
                        IHandlerRepository handlerRepository, IMessageBuilder messageBuilder,
                        IReinjectionEngine reinjectionEngine)
        {
            JoinedBusInfo = BusInfo.Create();

            ConfigureStateMachine();

            _identification          = identification;
            _messageBuilder          = messageBuilder;
            _reinjectionEngine       = reinjectionEngine;
            _inputGateway            = inputGateway;
            _inputGateway.OnMessage += MessageReceived;
            _handlerRepository       = handlerRepository;
        }
Ejemplo n.º 22
0
 /// <summary>
 /// Creates the direct engine.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="inputGateway">The input gateway.</param>
 /// <returns></returns>
 public static IReinjectionEngine CreateDefaultEngine <TMessage>(IInputGateway <TMessage, MessageHeader> inputGateway)
 {
     return(new DirectReinjectionEngine <TMessage>(inputGateway));
 }
Ejemplo n.º 23
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="DirectReinjectionEngine{TMessage}" /> class.
 /// </summary>
 /// <param name="inputGateway">The input gateway.</param>
 public DirectReinjectionEngine(IInputGateway <TMessage, MessageHeader> inputGateway)
 {
     _inputGateway = inputGateway;
     InitializeStateMachine();
 }
Ejemplo n.º 24
0
 /// <summary>
 ///     Creates the service processor.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="messageBuilder">The message builder.</param>
 /// <returns></returns>
 public static IProcessor CreateServiceProcessor(Identification identification,
                                                 IInputGateway<IMessage, MessageHeader> inputGateway,
                                                 IHandlerRepository handlerRepository,
                                                 IMessageBuilder messageBuilder)
 {
     return new ServiceProcessor(identification,
                                 inputGateway,
                                 handlerRepository,
                                 messageBuilder, ReinjectionEngineFactory.CreateDefaultEngine(inputGateway))
         {
             Logger = LoggerManager.Instance
         };
 }
Ejemplo n.º 25
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceProcessor"/> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 /// <param name="messageBuilder">The message builder.</param>
 /// <param name="reinjectionEngine">The reinjection engine.</param>
 internal ServiceProcessor(Identification identification,
                           IInputGateway <IMessage, MessageHeader> inputGateway,
                           IHandlerRepository handlerRepository, IMessageBuilder messageBuilder, IReinjectionEngine reinjectionEngine)
     : base(identification, inputGateway, handlerRepository, messageBuilder, reinjectionEngine)
 {
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentFake"/> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="inputGateway">The input gateway.</param>
 /// <param name="handlerRepository">The handler repository.</param>
 public AgentFake(Identification identification, IInputGateway <IMessage, MessageHeader> inputGateway, IHandlerRepository handlerRepository)
     : base(identification, inputGateway, handlerRepository, MessageBuilderFactory.CreateDefaultBuilder(), ReinjectionEngineFactory.CreateDefaultEngine(inputGateway))
 {
 }