具有多个输出到同一EventHub的Azure功能不起作用

时间:2018-06-08 14:07:30

标签: azure azure-functions

我有Azure Function,有两个输出绑定到Azure EventHub。输出是相同的EH但不同的主题。 只要out消息转到一个主题,它就能正常工作。如果输出到这两个主题,我会得到如下错误:

Exception while executing function: Functions.EventHubTriggerCSharp1. 
Microsoft.Azure.WebJobs.Host: Error while handling parameter 
outputEventHubMessageColdPath after function returned:. Microsoft.ServiceBus:
This event data instance has already been disposed.

虽然消息仅发送给1个主题。 你知道为什么我不能在这两个主题上得到消息吗? 顺便说一句代码与: Azure Function with Event Hub out binding does not work

感谢

1 个答案:

答案 0 :(得分:0)

好的,我通过改变来解决:

//Send it to both cold and hot path:
var message=CreateEHMessages("aggregates", rawMessageSection, deviceId, log);                  outputEventHubMessageHotPath.Add(message);
                outputEventHubMessageColdPath.Add(message);

为:

//Send it to both cold and hot path:
                    outputEventHubMessageHotPath.Add(CreateEHMessages("aggregates", rawMessageSection, deviceId, log));
                    outputEventHubMessageColdPath.Add(CreateEHMessages("aggregates", rawMessageSection, deviceId, log));