protected override void OnCommand(ITransport sender, Command command)
{
if(command.IsResponse)
{
Response response = (Response) command;
int correlationId = response.CorrelationId;
FutureResponse future = (FutureResponse) requestMap[correlationId];
if(future != null)
{
requestMap.Remove(correlationId);
future.Response = response;
if(response is ExceptionResponse)
{
ExceptionResponse er = response as ExceptionResponse;
BrokerError brokerError = er.Exception;
BrokerException exception = new BrokerException(brokerError);
this.exceptionHandler(this, exception);
}
}
else
{
if(Tracer.IsDebugEnabled)
{
Tracer.Debug("Unknown response ID: " + response.CommandId + " for response: " + response);
}
}
}
else
{
this.commandHandler(sender, command);
}
}