问题描述
我正在尝试创建一个从 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
这是 VSCode 中的错误弹出窗口:
我已经找了几个小时,一页又一页的谷歌搜索已经筋疲力尽了。我做错了什么?