java - 如何在 Java Azure 函数中使用事件中心触发器
问题描述
我正在尝试创建一个从 Azure 事件中心触发的 Java Azure 函数。我正在关注这些代码片段:https ://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs-trigger?tabs=java#example
这是我的代码:
package com.function;
import com.microsoft.azure.functions.*;
import com.microsoft.azure.function.annotation.*;
import java.util.Optional;
public class function {
@FunctionName("MTI")
public void EventHubProcess(
@EventHubTrigger(name = "msg", eventHubName = "mticallhub", connection = "EHubConnectionString"), String message, final ExecutionContext context)
{
context.getLogger().info("Java HTTP trigger processed a request: " + message);
}
}
这是我在构建时遇到的错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project func-MTI-test-zyg-001: Compilation failure
[ERROR] /C:/JavaStuff/FunctionApps/func-MTI-test-zyg-001/src/main/java/com/function/Function.java:[34,105] illegal start of type
我一直在寻找数小时和一页又一页的谷歌搜索。我究竟做错了什么?
解决方案
推荐阅读
- amazon-ec2 - NVMe EBS 卷:在 /dev/nvme1n1 增加 /home 分区,但 growpart 不起作用
- react-native - 确定相机纹理
- web-services - WS-Basenotification - SubscriptionReference 解释
- c# - 有没有办法在 WPF 项目中包含的单独类库中使用 2 个不同版本的第三方库?
- powershell - 遍历哈希表,找到小于数字的值,并将其添加到新的哈希表中
- reactjs - 如何在 React 组件的文本区域图标之前添加
- python - 你好,为什么当我使用相对路径时文件exists()返回False,但当路径是绝对路径时返回True?谢谢
- java - 当执行器服务需要对象时进行异步响应写入?
- python - 向 Flask API 发送 Post 请求,但未接收数据
- react-native - react-native 中登录的生物特征认证