[BUG] Writing multiple messages to a single Eventhub
See original GitHub issueInvestigative information
- Timestamp: 2021-12-18T18:29:00
- Function App name: (debugging locally)
- Function name(s) (as appropriate):(debugging locally)
- Core Tools version: 4.0.3971 Commit hash: d0775d487c93ebd49e9c1166d5c3c01f3c76eaaf (64-bit)
Repro steps
The function.json file is
{
"scriptFile": "__init__.py",
"bindings": [
{
"type": "eventHubTrigger",
"name": "inputEvent",
"direction": "in",
"eventHubName": "device.data.raw",
"connection": "EVENT_HUB_CONNECTION_STRING",
"cardinality": "one",
"consumerGroup": "$Default",
"dataType": "string"
},
{
"type": "eventHub",
"direction": "out",
"name": "$return",
"connection": "EVENT_HUB_CONNECTION_STRING",
"eventHubName": "device.data.decoded"
}
]
}
Test 1 - As per first proposition of 327
def main(inputEvent: func.EventHubEvent) -> typing.List[func.EventHubEvent]:
return (inputEvent.get_body(), inputEvent.get_body())
Test 2 - As per first proposition of 327
def main(inputEvent: func.EventHubEvent) -> typing.List[func.EventHubEvent]:
return (inputEvent.get_body(), inputEvent.get_body())
Test 3 - As per #192
def main(inputEvent: func.EventHubEvent) -> str:
return (inputEvent.get_body(), inputEvent.get_body())
Expected behavior
One of the methods should be able to send several messages to Eventhub
Actual behavior
Test 1
Function can not be started
[2021-12-08T17:36:04.098Z] Executed 'Functions.decode' (Failed, Id=a20e6894-0641-48be-a974-98e13ba7517e, Duration=329ms)
[2021-12-08T17:36:04.098Z] System.Private.CoreLib: Exception while executing function: Functions.decode. System.Private.CoreLib: Result: Failure
Exception: FunctionLoadError: cannot load the decode function: has invalid non-type return annotation typing.List[azure.functions._eventhub.EventHubEvent]
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 311, in _handle__function_load_request
self._functions.add_function(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\functions.py", line 240, in add_function
raise FunctionLoadError(
.
Test 2
Function can not be started
[2021-12-08T17:40:06.521Z] Executed 'Functions.decode' (Failed, Id=f3a5d015-67b4-4b50-bdb4-a4d14a3625de, Duration=256ms)
[2021-12-08T17:40:06.527Z] System.Private.CoreLib: Exception while executing function: Functions.decode. System.Private.CoreLib: Result: Failure
Exception: FunctionLoadError: cannot load the decode function: has invalid non-type return annotation typing.List[str]
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 311, in _handle__function_load_request
self._functions.add_function(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\functions.py", line 240, in add_function
raise FunctionLoadError(
.
Test 3
Function is started but there is an execution error:
[2021-12-08T17:56:36.411Z] Executed 'Functions.decode' (Failed, Id=cc123efe-9b7a-419c-8e4a-a29b3be2e8cb, Duration=40ms)
[2021-12-08T17:56:36.412Z] System.Private.CoreLib: Exception while executing function: Functions.decode. System.Private.CoreLib: Result: Failure
Exception: NotImplementedError: unexpected Datum type: None
Stack: File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\dispatcher.py", line 427, in _handle__invocation_request
return_value = bindings.to_outgoing_proto(
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\bindings\meta.py", line 117, in to_outgoing_proto
return datumdef.datum_as_proto(datum)
File "C:\Program Files\Microsoft\Azure Functions Core Tools\workers\python\3.9/WINDOWS/X64\azure_functions_worker\bindings\datumdef.py", line 190, in datum_as_proto
raise NotImplementedError(
.
Known workarounds
N/A
Contents of the requirements.txt file:
azure-functions==1.8.0
requests==2.26.0
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Troubleshoot connectivity issues - Azure Event Hubs
If the application isn't able to connect to the event hub at all, follow steps from this section to troubleshoot the issue.
Read more >AZURE Event Hub processing multiple protocols to same Topic
Can I use both AMQP and http(s) to write to the same Event Hub Topic; and subsequently can a single AZURE Function read...
Read more >Azure Event Hubs Are Not Queues - Tinkerer
Event Hubs uses a partitioning model where messages sent to it are distributed among partitions. Each partition has one reader that can read...
Read more >Azure Event Hub Tutorial | Big data message streaming service
Azure Event Hubs is highly scalable big data event processing service capable of processing millions of events per second.
Read more >Azure Event Hub | ThirdEye Data
Event Hubs provides message streaming through a partitioned consumer pattern in which each consumer only reads a specific subset, or partition, of the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks @YunchuWang for those explanations.
Hi @YunchuWang, yes I still have the issue. Glad that you are able to reproduce