Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProducerQueueRpc{T}" /> class.
        /// </summary>
        /// <param name="configuration">The configuration.</param>
        /// <param name="sendMessages">The send messages.</param>
        /// <param name="responseIdFactory">The response identifier factory.</param>
        /// <param name="messageFactory">The message factory.</param>
        /// <param name="rpcTimeoutFactory">The RPC timeout factory.</param>
        /// <param name="generateMessageHeaders">The generate message headers.</param>
        /// <param name="addStandardMessageHeaders">The add standard message headers.</param>
        public ProducerQueueRpc(
            QueueProducerConfiguration configuration,
            ISendMessages sendMessages,
            IResponseIdFactory responseIdFactory,
            IMessageFactory messageFactory,
            IRpcTimeoutFactory rpcTimeoutFactory,
            GenerateMessageHeaders generateMessageHeaders,
            AddStandardMessageHeaders addStandardMessageHeaders)
        {
            Guard.NotNull(() => configuration, configuration);
            Guard.NotNull(() => sendMessages, sendMessages);
            Guard.NotNull(() => responseIdFactory, responseIdFactory);
            Guard.NotNull(() => messageFactory, messageFactory);
            Guard.NotNull(() => rpcTimeoutFactory, rpcTimeoutFactory);
            Guard.NotNull(() => generateMessageHeaders, generateMessageHeaders);
            Guard.NotNull(() => addStandardMessageHeaders, addStandardMessageHeaders);


            _configuration             = configuration;
            _sendMessages              = sendMessages;
            _responseIdFactory         = responseIdFactory;
            _messageFactory            = messageFactory;
            _rpcTimeoutFactory         = rpcTimeoutFactory;
            _generateMessageHeaders    = generateMessageHeaders;
            _addStandardMessageHeaders = addStandardMessageHeaders;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StandardHeaders"/> class.
        /// </summary>
        /// <param name="messageContextDataFactory">The message context data factory.</param>
        /// <param name="timeoutFactory">The timeout factory.</param>
        public StandardHeaders(IMessageContextDataFactory messageContextDataFactory, IRpcTimeoutFactory timeoutFactory)
        {
            Guard.NotNull(() => messageContextDataFactory, messageContextDataFactory);
            Guard.NotNull(() => timeoutFactory, timeoutFactory);

            RpcTimeout                = messageContextDataFactory.Create("Queue-RPCTimeout", timeoutFactory.Create(TimeSpan.Zero));
            RpcResponseId             = messageContextDataFactory.Create <string>("Queue-RPCResponseID", null);
            RpcConsumerException      = messageContextDataFactory.Create <Exception>("Queue-RPCConsumerException", null);
            RpcConnectionInfo         = messageContextDataFactory.Create <IConnectionInformation>("Queue-RPCConnectionInfo", null);
            RpcContext                = messageContextDataFactory.Create <IRpcContext>("Queue-RPCContext", null);
            FirstPossibleDeliveryDate = messageContextDataFactory.Create <ValueTypeWrapper <DateTime> >("Queue-FirstPossibleDeliveryDate", null);
            MessageInterceptorGraph   =
                messageContextDataFactory.Create("Queue-MessageInterceptorGraph",
                                                 new MessageInterceptorsGraph());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StandardHeaders"/> class.
        /// </summary>
        /// <param name="messageContextDataFactory">The message context data factory.</param>
        /// <param name="timeoutFactory">The timeout factory.</param>
        public StandardHeaders(IMessageContextDataFactory messageContextDataFactory, IRpcTimeoutFactory timeoutFactory)
        {
            Guard.NotNull(() => messageContextDataFactory, messageContextDataFactory);
            Guard.NotNull(() => timeoutFactory, timeoutFactory);

            RpcTimeout = messageContextDataFactory.Create("Queue-RPCTimeout", timeoutFactory.Create(TimeSpan.Zero));
            RpcResponseId = messageContextDataFactory.Create<string>("Queue-RPCResponseID", null);
            RpcConsumerException = messageContextDataFactory.Create<Exception>("Queue-RPCConsumerException", null);
            RpcConnectionInfo = messageContextDataFactory.Create<IConnectionInformation>("Queue-RPCConnectionInfo", null);
            RpcContext = messageContextDataFactory.Create<IRpcContext>("Queue-RPCContext", null);
            FirstPossibleDeliveryDate = messageContextDataFactory.Create<ValueTypeWrapper<DateTime>>("Queue-FirstPossibleDeliveryDate", null);
            MessageInterceptorGraph =
                messageContextDataFactory.Create("Queue-MessageInterceptorGraph",
                    new MessageInterceptorsGraph());
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MessageProcessingRpcSend{TSendMessage}" /> class.
        /// </summary>
        /// <param name="sendQueue">The send queue.</param>
        /// <param name="rpcTimeoutFactory">The RPC timeout factory.</param>
        /// <param name="headers">The headers.</param>
        /// <param name="connectionInformation">The connection information.</param>
        public MessageProcessingRpcSend(
            IProducerQueue <TSendMessage> sendQueue,
            IRpcTimeoutFactory rpcTimeoutFactory,
            IHeaders headers,
            IConnectionInformation connectionInformation)
        {
            Guard.NotNull(() => sendQueue, sendQueue);
            Guard.NotNull(() => rpcTimeoutFactory, rpcTimeoutFactory);
            Guard.NotNull(() => headers, headers);
            Guard.NotNull(() => connectionInformation, connectionInformation);

            _sendQueue             = sendQueue;
            _rpcTimeoutFactory     = rpcTimeoutFactory;
            _headers               = headers;
            _connectionInformation = connectionInformation;
        }