/// <summary>
        /// Handles the specified message.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="data">The additional message data.</param>
        /// <param name="timeOut">The time out.</param>
        /// <returns></returns>
        public ISentMessage Handle(TSendMessage message, IAdditionalMessageData data, TimeSpan timeOut)
        {
            //store the destination queue as a header
            data.SetHeader(_headers.StandardHeaders.RpcConnectionInfo, _connectionInformation.Clone());

            //store the timeout as a header
            data.SetHeader(_headers.StandardHeaders.RpcTimeout, _rpcTimeoutFactory.Create(timeOut));

            //send the request
            return(_sendQueue.Send(message, data).SentMessage);
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the ipc internal headers.
 /// </summary>
 /// <param name="messageToSend">The message to send.</param>
 /// <param name="responseId">The response identifier.</param>
 private void SetIpcInternalHeaders(IMessage messageToSend, IResponseId responseId)
 {
     messageToSend.SetInternalHeader(Configuration.HeaderNames.StandardHeaders.RpcTimeout,
                                     _rpcTimeoutFactory.Create(responseId.TimeOut));
     messageToSend.SetInternalHeader(Configuration.HeaderNames.StandardHeaders.RpcResponseId,
                                     responseId.MessageId.Id.Value.ToString());
 }
Esempio n. 3
0
        /// <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());
        }