public override Task <IServiceRemotingResponseMessageBody> HandleRequestResponseAsync(
     ServiceRemotingDispatchHeaders requestMessageDispatchHeaders,
     IServiceRemotingRequestMessageBody requestMessageBody,
     CancellationToken cancellationToken)
 {
     return(base.HandleRequestResponseAsync(requestMessageDispatchHeaders, requestMessageBody, cancellationToken));
 }
        private IServiceRemotingRequestMessageHeader CreateServiceRemotingRequestMessageHeader(
            ServiceRemotingDispatchHeaders serviceRemotingDispatchHeaders)
        {
            InterfaceDetails details;

            if (ServiceCodeBuilder.TryGetKnownTypes(serviceRemotingDispatchHeaders.ServiceInterfaceName, out details))
            {
                var headers = new ServiceRemotingRequestMessageHeader();
                headers.InterfaceId = details.Id;
                var headersMethodId = 0;
                if (details.MethodNames.TryGetValue(serviceRemotingDispatchHeaders.MethodName, out headersMethodId))
                {
                    headers.MethodId = headersMethodId;
                }
                else
                {
                    throw new NotSupportedException("This Method is not Supported" +
                                                    serviceRemotingDispatchHeaders.MethodName);
                }

                return(headers);
            }
            throw new NotSupportedException("This Interface is not Supported" +
                                            serviceRemotingDispatchHeaders.ServiceInterfaceName);
        }
        /// <summary>
        /// Handles a message from the client that requires a response from the service. This Api can be used for the short-circuiting where client is in same process as service.
        /// Client can now directly dispatch request to service instead of using ServiceProxy.
        /// </summary>
        /// <param name="requestMessageDispatchHeaders">Request message headers</param>
        /// <param name="requestMessageBody">Request message body</param>
        /// <param name="cancellationToken">Cancellation token. It can be used to cancel the request</param>
        public virtual Task <IServiceRemotingResponseMessageBody> HandleRequestResponseAsync(
            ServiceRemotingDispatchHeaders requestMessageDispatchHeaders,
            IServiceRemotingRequestMessageBody requestMessageBody,
            CancellationToken cancellationToken)
        {
            var header = this.CreateServiceRemotingRequestMessageHeader(requestMessageDispatchHeaders);

            return(this.HandleRequestResponseAsync(header, requestMessageBody, cancellationToken));
        }