Don't call BasicConsume inside Call method
This commit is contained in:
parent
08d574812f
commit
12fbf18d9b
@ -34,6 +34,11 @@ public RpcClient()
|
|||||||
var response = Encoding.UTF8.GetString(body);
|
var response = Encoding.UTF8.GetString(body);
|
||||||
tcs.TrySetResult(response);
|
tcs.TrySetResult(response);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
channel.BasicConsume(
|
||||||
|
consumer: consumer,
|
||||||
|
queue: replyQueueName,
|
||||||
|
autoAck: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Task<string> CallAsync(string message, CancellationToken cancellationToken = default(CancellationToken))
|
public Task<string> CallAsync(string message, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
@ -52,11 +57,6 @@ public RpcClient()
|
|||||||
basicProperties: props,
|
basicProperties: props,
|
||||||
body: messageBytes);
|
body: messageBytes);
|
||||||
|
|
||||||
channel.BasicConsume(
|
|
||||||
consumer: consumer,
|
|
||||||
queue: replyQueueName,
|
|
||||||
autoAck: true);
|
|
||||||
|
|
||||||
cancellationToken.Register(() => callbackMapper.TryRemove(correlationId, out var tmp));
|
cancellationToken.Register(() => callbackMapper.TryRemove(correlationId, out var tmp));
|
||||||
return tcs.Task;
|
return tcs.Task;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user