Exemplo n.º 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;
        }
Exemplo n.º 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;
 }
Exemplo n.º 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));
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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
     };
 }
Exemplo n.º 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);
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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));
 }
Exemplo n.º 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));
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }
Exemplo n.º 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;
        }
Exemplo n.º 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)
 {
 }
Exemplo n.º 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[]>>();
 }
Exemplo n.º 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[]> >();
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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
     });
 }
Exemplo n.º 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
     };
 }
Exemplo n.º 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;
 }
Exemplo n.º 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
     };
 }
Exemplo n.º 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);
        }
Exemplo n.º 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)
 {
 }