简体   繁体   English

带有 IoT 中心触发器的 Java Azure 函数未启动

[英]Java Azure Function with IoT Hub trigger is not starting

i am trying to trigger a java function each time my IoT Hub receives a batch of 64 messages (or whatever, the number is not important).每次我的 IoT 中心收到一批 64 条消息(或其他任何消息,数字并不重要)时,我都试图触发一个 java 函数。 I followed this guide to create the basic code, then i edited creating this function我按照本指南创建了基本代码,然后我编辑了创建此函数

public class Function {

@FunctionName("ProcessIotMessages")
public void processIotMessages(
        @EventHubTrigger(name = "message",
                eventHubName = "samples-workitems",
                connection = "HUB-1544-DEV_events_IOTHUB") List<String> messages,
        final ExecutionContext context) {...Function Logic...}
}

The connection parameter is the IoT Hub connection string in formatted as event hub compatible endpoint (eg Endpoint=sb://iothub-hostname-blablabla).连接参数是格式为事件中心兼容端点的 IoT 中心连接字符串(例如 Endpoint=sb://iothub-hostname-blablabla)。

I package and deploy this code with maven plugins specified in the guide linked above.我使用上面链接的指南中指定的 Maven 插件打包和部署此代码。 The deploys works fine, i can see mi function up and running with no errors from the portal, the HUB-1544-DEV_events_IOTHUB setting app is correctly created with the correct connection string.部署工作正常,我可以从门户看到 mi 功能正常运行,没有错误,HUB-1544-DEV_events_IOTHUB 设置应用程序使用正确的连接字符串正确创建。

The only strange thing i notice in the portal is in the trigger blade.我在传送门中注意到的唯一奇怪的东西是扳机刀片。 As you can see, cardinality is One, while it should be set to many, since i did not specify the cardinality parameter in the function.如您所见,基数是一,而它应该设置为多,因为我没有在函数中指定基数参数。 The default one is many according to this guide .根据本指南,默认值为 many 。 This makes me think that i not being able to pass the correct trigger syntax.这让我觉得我无法传递正确的触发器语法。

Anyway, the problem is that this function is not starting either from my local machine or the portal.无论如何,问题是这个功能不是从我的本地机器或门户网站启动的。 Any suggestions?有什么建议? Thx谢谢

As @evilSnobu posted in the comments, the problem was the event hub name.正如@evilSnobu 在评论中发布的那样,问题在于事件中心名称。 Just go to Portal -> your IoT Hub -> Built-in endpoints and find all the information to configure the trigger in there.只需转到Portal -> your IoT Hub -> Built-in endpoints然后在其中找到配置触发器的所有信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM