title: How to abort [ActivityTrigger] function in Durable Functions
body: <p>I have a [DurableOrchestrationClient] that starts a [OrchestrationTrigger] that starts a long running [ActivityTrigger] function.<br>
  I know how to use TerminateAsync() to Terminate the [OrchestrationTrigger] from running.  </p>
  
  <p>The problem is that [ActivityTrigger] is not aborted when I terminate the [OrchestrationTrigger] function. [ActivityTrigger] keeps running until its done.<br>
  I need a way to abort the long running [ActivityTrigger] when I call TerminateAsync().</p>
  
  <p>My guess is that I can pass a CancellationToken to [ActivityTrigger] function and then check cancellationToken.IsCancellationRequested to abort.<br>
  But how to do this?</p>
  
  <p>Here is a test code </p>
  
  <pre><code>
          [FunctionName("A_ProcessPayment")]
          public static async Task&lt;processTracker&gt; A_ProcessPayment(
              [ActivityTrigger] DurableActivityContext context, 
              TraceWriter log,
              CancellationToken cancellationToken)
          {
              processTracker p = context.GetInput&lt;processTracker&gt;();
  
              try
              {
                  for (int i = 0; i &lt; 5; i++){
                      if (cancellationToken.IsCancellationRequested) // This is always false! 
                      {
                          break;  
                      }
  
                      Trace.WriteLine("Long task loop: " + i);
                      await Task.Delay(10000);
                  }
              }
              catch (OperationCanceledException) {
                  log.Warning("C# HTTP trigger function canceled.");
                  return p;
              }
  
              Trace.WriteLine("Long task DONE");
              return p;
          }
  </code></pre>