예제 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AbstractInputGateway&lt;TMessage&gt;"/> class.
        /// </summary>
        /// <param name="receiverReceiverEndPoint">The receiver receiver end point.</param>
        /// <param name="dataContractSerializer">The data contract serializer.</param>
        /// <param name="maxReijections">The max reijections.</param>
        protected AbstractInputGateway(IReceiverEndPoint receiverReceiverEndPoint, IDataContractSerializer dataContractSerializer, int maxReijections)
        {
            _receiverReceiverEndPoint = receiverReceiverEndPoint;
            _maxReijections           = maxReijections;
            DataContractSerializer    = dataContractSerializer;

            _receiverReceiverEndPoint.OnReceivedMessage += OnReceiverEndPointHandler;
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentOutputGateway"/> class.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="senderEndPoints">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="defaultPriority">The default priority.</param>
 internal AgentOutputGateway(Identification identification,
                             ISenderEndPoint senderEndPoints,
                             IDataContractSerializer dataContractSerializer,
                             int defaultPriority = 0)
     : base(senderEndPoints, dataContractSerializer)
 {
     _identification  = identification;
     _defaultPriority = defaultPriority;
 }
예제 #3
0
 /// <summary>
 /// Creates the input gateway.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="numberOfParallelTasks">The number of parallel tasks.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static RouterInputGateway CreateInputGateway(Uri uri,
                                                     TransportType transportType,
                                                     IDataContractSerializer dataContractSerializer,
                                                     int numberOfParallelTasks, int maxReijections)
 {
     return(CreateInputGateway(EndPointFactory.CreateReceiverEndPoint(uri, transportType, numberOfParallelTasks),
                               dataContractSerializer,
                               maxReijections));
 }
예제 #4
0
 /// <summary>
 /// Creates the agent input gateway.
 /// </summary>
 /// <param name="receiverEndPoint">The receiver end point.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static RouterInputGateway CreateInputGateway(IReceiverEndPoint receiverEndPoint,
                                                     IDataContractSerializer dataContractSerializer,
                                                     int maxReijections)
 {
     return(new RouterInputGateway(receiverEndPoint, dataContractSerializer, maxReijections)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #5
0
 /// <summary>
 /// Creates the agent input gateway.
 /// </summary>
 /// <param name="receiverEndPoint">The receiver end point.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static RouterInputGateway CreateInputGateway(IReceiverEndPoint receiverEndPoint, 
                                                     IDataContractSerializer dataContractSerializer, 
                                                     int maxReijections)
 {
     return new RouterInputGateway(receiverEndPoint, dataContractSerializer, maxReijections)
     {
         Logger = LoggerManager.Instance
     };
 }
예제 #6
0
 /// <summary>
 /// Creates the input gateway.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="numberOfParallelTasks">The number of parallel tasks.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static RouterInputGateway CreateInputGateway(Uri uri, 
                                                     TransportType transportType, 
                                                     IDataContractSerializer dataContractSerializer,
                                                     int numberOfParallelTasks, int maxReijections)
 {
     return CreateInputGateway(EndPointFactory.CreateReceiverEndPoint(uri, transportType, numberOfParallelTasks),
                                 dataContractSerializer,
                                 maxReijections);
 }
예제 #7
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static AgentOutputGateway CreateOutputGateway(Identification identification,
                                                      Uri uri,
                                                      TransportType transportType,
                                                      IDataContractSerializer dataContractSerializer)
 {
     return(new AgentOutputGateway(identification, EndPointFactory.CreateSenderEndPoint(uri, transportType), dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #8
0
 /// <summary>
 /// Creates the agent input gateway.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="receiverEndPoint">The receiver end point.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static AgentInputGateway <TMessage> CreateInputGateway <TMessage>(IReceiverEndPoint receiverEndPoint,
                                                                          IDataContractSerializer dataContractSerializer,
                                                                          int maxReijections)
     where TMessage : IMessage
 {
     return(new AgentInputGateway <TMessage>(receiverEndPoint, dataContractSerializer, maxReijections)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #9
0
 /// <summary>
 /// Creates the input gateway.
 /// </summary>
 /// <typeparam name="TMessage">The type of the message.</typeparam>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="numberOfParallelTasks">The number of parallel tasks.</param>
 /// <param name="maxReijections">The max reijections.</param>
 /// <returns></returns>
 public static AgentInputGateway <TMessage> CreateInputGateway <TMessage>(Uri uri,
                                                                          TransportType transportType,
                                                                          IDataContractSerializer dataContractSerializer,
                                                                          int numberOfParallelTasks, int maxReijections)
     where TMessage : IMessage
 {
     return(CreateInputGateway <TMessage>(EndPointFactory.CreateReceiverEndPoint(uri, transportType, numberOfParallelTasks),
                                          dataContractSerializer,
                                          maxReijections));
 }
예제 #10
0
        /// <summary>
        ///     Creates the instance.
        /// </summary>
        /// <param name="dataContractSerializer">The data contract serializer.</param>
        /// <param name="type">The type.</param>
        /// <param name="serializedObject">The serialized object.</param>
        /// <param name="encoding">The encoding.</param>
        /// <returns></returns>
        public object CreateInstance(IDataContractSerializer dataContractSerializer, Type type, string serializedObject,
                                     Encoding encoding)
        {
            Type relatedType = _objectBuilder.GetRelatedType(type);

            if (relatedType == null)
            {
                LoggerManager.Instance.Error(string.Format("Mierda el related Type es nulo {0}", type.FullName));
            }
            return(dataContractSerializer.Deserialize(serializedObject, encoding, relatedType));
        }
예제 #11
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();
        }
예제 #12
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();
        }
예제 #13
0
        /// <summary>
        /// Creates the specified identification.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="message">The message.</param>
        /// <param name="dataContractSerializer">The data contract serializer.</param>
        /// <returns></returns>
        public static MessageBus Create(Identification identification, IMessage message, IDataContractSerializer dataContractSerializer)
        {
            var messageBus = new MessageBus
                                 {
                                     Header =
                                         {
                                             CreatedAt = DateTime.UtcNow,
                                             IdentificationService =
                                                 {
                                                     Id = identification.Id,
                                                     Type = identification.Type
                                                 },
                                             BodyType = GetKey(message.GetType()),
                                             Type = MessageBusType.Generic,
                                             EncodingCodePage = dataContractSerializer.Encoding.CodePage
                                         },
                                     Body = dataContractSerializer.Serialize(message)
                                 };

            return messageBus;
        }
예제 #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentInputGateway&lt;TMessage&gt;"/> class.
 /// </summary>
 /// <param name="receiverEndPoint">The receiver end point.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <param name="maxReijections">The max reijections.</param>
 internal AgentInputGateway(IReceiverEndPoint receiverEndPoint, IDataContractSerializer dataContractSerializer, int maxReijections)
     : base(receiverEndPoint, dataContractSerializer, maxReijections)
 {
 }
예제 #15
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RouterOutputHelper" /> class.
 /// </summary>
 /// <param name="gatewaysRepository">The sender repository.</param>
 public RouterOutputHelper(IGatewaysRepository gatewaysRepository)
 {
     _gatewaysRepository = gatewaysRepository;
     _dataContractSerializer = new JsonDataContractSerializer();
     _subcriptorsList = new Dictionary<Identification, IOutputGateway<byte[]>>();
 }
예제 #16
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="RouterOutputHelper" /> class.
 /// </summary>
 /// <param name="gatewaysRepository">The sender repository.</param>
 public RouterOutputHelper(IGatewaysRepository gatewaysRepository)
 {
     _gatewaysRepository     = gatewaysRepository;
     _dataContractSerializer = new JsonDataContractSerializer();
     _subcriptorsList        = new Dictionary <Identification, IOutputGateway <byte[]> >();
 }
예제 #17
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="senderEndPoint">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static RouterOutputGateway CreateOutputGateway(ISenderEndPoint senderEndPoint, IDataContractSerializer dataContractSerializer)
 {
     return(new RouterOutputGateway(senderEndPoint, dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #18
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static RouterOutputGateway CreateOutputGateway(Uri uri, TransportType transportType, IDataContractSerializer dataContractSerializer)
 {
     return(new RouterOutputGateway(EndPointFactory.CreateSenderEndPoint(uri, transportType), dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #19
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="identification">The identification.</param>
 /// <param name="senderEndPoint">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static AgentOutputGateway CreateOutputGateway(Identification identification, ISenderEndPoint senderEndPoint, IDataContractSerializer dataContractSerializer)
 {
     return(new AgentOutputGateway(identification, senderEndPoint, dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     });
 }
예제 #20
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="senderEndPoint">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static RouterOutputGateway CreateOutputGateway(ISenderEndPoint senderEndPoint, IDataContractSerializer dataContractSerializer)
 {
     return new RouterOutputGateway(senderEndPoint, dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     };
 }
예제 #21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AgentOutputGateway"/> class.
 /// </summary>
 /// <param name="senderEndPoint">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 protected AbstractOutputGateway(ISenderEndPoint senderEndPoint, IDataContractSerializer dataContractSerializer)
 {
     SenderEndPoint         = senderEndPoint;
     DataContractSerializer = dataContractSerializer;
 }
예제 #22
0
 /// <summary>
 /// Creates the output gateway.
 /// </summary>
 /// <param name="uri">The URI.</param>
 /// <param name="transportType">The supported transports.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 /// <returns></returns>
 public static RouterOutputGateway CreateOutputGateway(Uri uri, TransportType transportType, IDataContractSerializer dataContractSerializer)
 {
     return new RouterOutputGateway(EndPointFactory.CreateSenderEndPoint(uri, transportType), dataContractSerializer)
     {
         Logger = LoggerManager.Instance
     };
 }
예제 #23
0
        /// <summary>
        /// Creates the specified identification.
        /// </summary>
        /// <param name="identification">The identification.</param>
        /// <param name="message">The message.</param>
        /// <param name="dataContractSerializer">The data contract serializer.</param>
        /// <returns></returns>
        public static MessageBus Create(Identification identification, IMessage message, IDataContractSerializer dataContractSerializer)
        {
            var messageBus = new MessageBus
            {
                Header =
                {
                    CreatedAt             = DateTime.UtcNow,
                    IdentificationService =
                    {
                        Id   = identification.Id,
                        Type = identification.Type
                    },
                    BodyType         = GetKey(message.GetType()),
                    Type             = MessageBusType.Generic,
                    EncodingCodePage = dataContractSerializer.Encoding.CodePage
                },
                Body = dataContractSerializer.Serialize(message)
            };

            return(messageBus);
        }
예제 #24
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RouterOutputGateway"/> class.
 /// </summary>
 /// <param name="senderEndPoint">The sender end points.</param>
 /// <param name="dataContractSerializer">The data contract serializer.</param>
 public RouterOutputGateway(ISenderEndPoint senderEndPoint, IDataContractSerializer dataContractSerializer)
     : base(senderEndPoint, dataContractSerializer)
 {
 }