You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Spring Cloud Data Flow UI中接入Azure服务作为源与接收器?

接入Azure Service Bus和Event Hubs到Spring Cloud Data Flow

Spring Cloud Data Flow(SCDF)默认未内置Azure Service Bus和Event Hubs的源/接收器组件,但可以借助Spring Cloud Stream的Azure绑定器,通过自定义应用注册的方式快速接入,具体步骤如下:

1. 构建自定义Spring Cloud Stream应用

基于Spring Cloud Stream的Azure绑定器,创建对应的源(Source)或接收器(Sink)应用:

  • Service Bus 相关:引入对应依赖(队列场景用spring-cloud-starter-stream-azure-servicebus-queue,主题场景用spring-cloud-starter-stream-azure-servicebus-topic)
  • Event Hubs 相关:引入spring-cloud-starter-stream-azure-eventhubs依赖
  • 编写极简业务逻辑:源应用仅需绑定Service Bus通道完成消息读取,接收器应用绑定Event Hubs通道完成消息写入,无需复杂业务代码
  • 执行mvn clean package打包为可执行JAR包

2. 将应用注册到SCDF

通过SCDF CLI或UI完成应用注册:

  • CLI方式:执行注册命令,示例:
    # 注册Service Bus源应用
    app register --type source --name azure-servicebus-source --uri maven://com.your-org:azure-servicebus-source:1.0.0
    # 注册Event Hubs接收器应用
    app register --type sink --name azure-eventhubs-sink --uri maven://com.your-org:azure-eventhubs-sink:1.0.0
    
    其中uri替换为你自己的应用Maven坐标、本地文件路径或远程可访问URL。
  • UI方式:进入SCDF控制台的「Apps」页面,点击「Register App」,选择应用类型(Source/Sink),填写名称和应用地址后完成注册。

3. 配置并使用应用

在SCDF中创建数据流管道时,选择已注册的Azure相关应用,并配置Azure服务的连接属性:

  • Service Bus源应用示例配置:
    spring.cloud.stream.azure.servicebus.connection-string=你的Service Bus连接字符串
    spring.cloud.stream.bindings.output.destination=目标主题/队列名称
    
  • Event Hubs接收器应用示例配置:
    spring.cloud.stream.azure.eventhubs.connection-string=你的Event Hubs连接字符串
    spring.cloud.stream.bindings.input.destination=目标Event Hub名称
    

完成配置后,即可像使用SCDF内置组件一样,构建基于Azure Service Bus和Event Hubs的消息处理管道。

内容的提问来源于stack exchange,提问作者Alan Krueger

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 07:37:19