Copy/paste this example into my EventHubTrigger method, so the method signature looks like:
public static void ProcessMessage( [EventHubTrigger(Constants.EventHubName, ConsumerGroup = Constants.ConsumerGroupName)] MyMessage message, string partitionKey, DateTime enqueuedTimeUtc, IDictionary<string, object> properties, IDictionary<string, object> systemProperties) { ...
Start my WebJob
This error is thrown:
Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: 'Error indexing method 'Functions.ProcessMessage''InnerException: InvalidOperationException: Cannot bind parameter 'partitionKey' to type String. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
Expected behavior
WebJob should start successfully, and receive my un-read messages (as it did before I pasted in these additional binding properties. When the only parameter that I had was MyMessage message, everything was working fine.
Actual behavior
When RunAndBlock() is called, the error above is thrown as the WebJob tries to bind my EventHubTrigger method and its parameters (which now contain all the ones listed above that are properties of EventData, in addition to the MyMessage parameter).
Known workarounds
Do not attempt to bind to any EventData properties such as enqueuedTimeUtc (which I'm most interested in accessing).
Binding an EventHubTrigger method's parameters to EventData properties throws an error.
Repro steps
I am following the first example for EventHubTrigger, here: https://github.com/Azure/azure-webjobs-sdk/wiki/Trigger-Binding-Data
public static void ProcessMessage( [EventHubTrigger(Constants.EventHubName, ConsumerGroup = Constants.ConsumerGroupName)] MyMessage message, string partitionKey, DateTime enqueuedTimeUtc, IDictionary<string, object> properties, IDictionary<string, object> systemProperties) { ...
Microsoft.Azure.WebJobs.Host.Indexers.FunctionIndexingException: 'Error indexing method 'Functions.ProcessMessage''
InnerException: InvalidOperationException: Cannot bind parameter 'partitionKey' to type String. Make sure the parameter Type is supported by the binding. If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
Expected behavior
WebJob should start successfully, and receive my un-read messages (as it did before I pasted in these additional binding properties. When the only parameter that I had was
MyMessage message
, everything was working fine.Actual behavior
When RunAndBlock() is called, the error above is thrown as the WebJob tries to bind my EventHubTrigger method and its parameters (which now contain all the ones listed above that are properties of
EventData
, in addition to theMyMessage
parameter).Known workarounds
Do not attempt to bind to any EventData properties such as enqueuedTimeUtc (which I'm most interested in accessing).
Related information