public TResponse SendRequestMessage <TResponse, TRequest>(TRequest message) { using (EneterTrace.Entering()) { try { ISerializer aSerializer = mySerializer.ForResponseReceiver(AttachedDuplexOutputChannel.ResponseReceiverId); MultiTypedMessage aRequest = new MultiTypedMessage(); aRequest.TypeName = typeof(TRequest).Name; aRequest.MessageData = aSerializer.Serialize <TRequest>(message); MultiTypedMessage aResponse = mySender.SendRequestMessage(aRequest); TResponse aResult = aSerializer.Deserialize <TResponse>(aResponse.MessageData); return(aResult); } catch (Exception err) { string anErrorMessage = TracedObject + ErrorHandler.FailedToSendMessage; EneterTrace.Error(anErrorMessage, err); throw; } } }
public void SendResponseMessage <TResponseMessage>(string responseReceiverId, TResponseMessage responseMessage) { using (EneterTrace.Entering()) { MultiTypedMessage aMessage = new MultiTypedMessage(); aMessage.TypeName = typeof(TResponseMessage).Name; aMessage.MessageData = mySerializer.ForResponseReceiver(responseReceiverId).Serialize <TResponseMessage>(responseMessage); myReceiver.SendResponseMessage(responseReceiverId, aMessage); } }
public void SendRequestMessage <TRequestMessage>(TRequestMessage message) { using (EneterTrace.Entering()) { try { MultiTypedMessage aMessage = new MultiTypedMessage(); aMessage.TypeName = typeof(TRequestMessage).Name; aMessage.MessageData = mySerializer.ForResponseReceiver(AttachedDuplexOutputChannel.ResponseReceiverId).Serialize <TRequestMessage>(message); mySender.SendRequestMessage(aMessage); } catch (Exception err) { string anErrorMessage = TracedObject + ErrorHandler.FailedToSendMessage; EneterTrace.Error(anErrorMessage, err); throw; } } }