https://docs.microsoft.com/en-us/java/azure/spring-framework/configure-spring-cloud-stream-binder-java-app-azure-event-hub?view=azure-java-stable
https://github.com/microsoft/spring-cloud-azure/tree/master/spring-cloud-azure-samples/eventhubs-operation-sample
以上链接为SpringCloud集成eventhub的文档和代码,由于默认是针对Azure Globle的Eventhub服务,如果要使用Azure China的相关资源,需要稍作修改
- maven依赖
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-spring-boot-starter</artifactId>
<version>${azure.version}</version>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>spring-cloud-starter-azure-eventhub</artifactId>
<version>1.1.0.RC1</version>
</dependency>
- application.properties配置
azure.storage.connection-string=xxx
# Fill event hub namespace connection string copied
Spring Cloud 集成 Azure China Eventhub 实践

本文档介绍了如何将Spring Cloud应用程序与Azure China的Eventhub服务集成。在官方文档和示例代码的基础上,由于默认配置适用于Azure Global,针对Azure China的资源需要进行调整。通过修改maven依赖和创建特定Bean来切换到Azure China环境,实践证明这种方法有效。
最低0.47元/天 解锁文章
1783





