/// <summary> /// Initializes a new instance of the <see cref="AbstractInputGateway<TMessage>"/> 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; }
/// <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; }
/// <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)); }
/// <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 }); }
/// <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 }; }
/// <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); }
/// <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 }); }
/// <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 }); }
/// <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)); }
/// <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)); }
/// <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(); }
/// <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(); }
/// <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; }
/// <summary> /// Initializes a new instance of the <see cref="AgentInputGateway<TMessage>"/> 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) { }
/// <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[]>>(); }
/// <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[]> >(); }
/// <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 }); }
/// <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 }); }
/// <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 }); }
/// <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 }; }
/// <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; }
/// <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 }; }
/// <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); }
/// <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) { }