在Java中使用EventProcessorHost接收消息时@Override中的Azure Eventhub错误

时间:2016-07-19 18:51:39

标签: java azure azure-eventhub

我有一个eventhub,我正在向它发送数据。现在我需要收到这些数据。所以我按照eventhub页面中的教程

https://azure.microsoft.com/en-us/documentation/articles/event-hubs-java-ephjava-getstarted/

“使用Java中的EventProcessorHost接收消息”

在所有课程中,它都没有让我  @覆盖。它给了我以下错误。

Multiple markers at this line
- implements com.microsoft.azure.eventprocessorhost.IEventProcessor.onOpen
- The method onOpen(PartitionContext) of type EventProcessor must override a superclass 

我添加了pom中指定的依赖项(我使用的是maven项目)。

<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs</artifactId>
<version>0.7.2</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-eventhubs-eph</artifactId>
<version>0.7.2</version>
</dependency>
</dependencies>

2 个答案:

答案 0 :(得分:1)

将项目引用更改为指向jdk1.8。

当您尝试使用jdk1.5编译Java项目时,这是一个非常常见的错误。 @Override注释&#39;规范在jdk1.5中更改为jdk1.6。

HTH!

答案 1 :(得分:0)

这很有可能发生,因为Maven依赖项配置不正确。

  1. 右键单击项目,选择Configure - &gt;转换为Maven项目,并完成向导。
  2. 使用maven资源管理器打开pom,然后单击Dependencies
  3. 添加适当的包裹。
  4. 如果您无法使用此功能,那么您可以下载事件中心的源代码并自行构建。