Azure / azure-functions-eventhubs-extension

Event Hubs extension for Azure Functions
MIT License
20 stars 26 forks source link

PartitionContext JSON serialization includes CancellationToken data. #119

Closed peterhuene closed 3 months ago

peterhuene commented 5 years ago

From @peterhuene on February 22, 2019 3:46

Actual Behavior

The Azure Functions Event Hubs trigger binding is sending a PartitionContext as part of the trigger metadata, serialized as JSON for extension languages.

However, the type has a public CancellationToken property that should probably be suppressed from JSON serialization.

Here's the JSON object that is serialized for the PartitionContext:

{
   "CancellationToken":{
      "IsCancellationRequested":false,
      "CanBeCanceled":true,
      "WaitHandle":{
         "Handle":{
            "value":2040
         },
         "SafeWaitHandle":{
            "IsInvalid":false,
            "IsClosed":false
         }
      }
   },
   "ConsumerGroupName":"$Default",
   "EventHubPath":"test",
   "PartitionId":"0",
   "Owner":"40eeeb3a-3491-4072-ba37-59ecdc330b6e",
   "RuntimeInformation":{
      "PartitionId":"0",
      "LastSequenceNumber":0,
      "LastEnqueuedTimeUtc":"0001-01-01T00:00:00",
      "LastEnqueuedOffset":null,
      "RetrievalTime":"0001-01-01T00:00:00"
   }
}

Expected Behavior

I'd expect the serialization output to not have the CancellationToken:

{
   "ConsumerGroupName":"$Default",
   "EventHubPath":"test",
   "PartitionId":"0",
   "Owner":"40eeeb3a-3491-4072-ba37-59ecdc330b6e",
   "RuntimeInformation":{
      "PartitionId":"0",
      "LastSequenceNumber":0,
      "LastEnqueuedTimeUtc":"0001-01-01T00:00:00",
      "LastEnqueuedOffset":null,
      "RetrievalTime":"0001-01-01T00:00:00"
   }
}

Versions

Copied from original issue: Azure/azure-event-hubs-dotnet#372

peterhuene commented 5 years ago

From @serkantkaraca on February 22, 2019 18:37

Please report the issue to WebJobs SDK. This is not something we can address here.