How to cancel a Request/Response communication with a CancellationToken in MassTransit ESB?
<p>I have a simple masstransit request/response proof of concept. It consists of two apps: one is for message sending and the other is for message consuming.
The message sending app goes like this:</p>

<pre><code>var basicClient=_busControl.CreateRequestClient&lt;IRequest,IResponse&gt;(queueUri, timeout);
return await basicClient.Request(new Request(json), token);
</code></pre>

<p>The <code>Request</code> method takes a <code>CancellationToken</code> as a second optional parameter.</p>

<p>The message consumer has the following code:</p>

<pre><code>public async Task Consume(ConsumeContext&lt;IRequest&gt; context)
{
      var outputJson = await _longRunningJob.Execute(context.Message.Input, context.CancellationToken);
      context.Respond(new Response(outputJson));
}
</code></pre>

<p>As we can see the <code>ConsumeContext</code> also has a <code>CancellationToken</code> field.</p>

<p>So the question is: how can I use these tokens? </p>

<p>In my message sending app I'd like to cancel waiting for the response, 
and in the message consumer I'd like to cancel waiting for the <code>_longrunningJob</code> completion. </p>

<ol>
<li>When I try to pass the token to the <code>Request</code> method and then call <code>Cancel()</code> on my <code>CancellationTokenSource</code> I expect the method to throw <code>OperationCancelledException</code>, but I just get the response!</li>
<li>I've also tried to pass an already cancelled token to this method, but nothing happened.</li>
<li>Then I've looked at Masstransit's source code and found out that token.ThrowIfCancellationIsRequested() is not called anywhere!</li>
</ol>

<p>So, please tell me, am I doing something wrong here and there is another way to deal with CancellationTokens, or it is just a Masstransit's bug?</p>