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

Spring Cloud Stream Kafka Streams函数式配置异常求助

Spring Cloud Stream函数式配置Kafka Streams问题

问题现象

  • IDEA对application.yml中的cloud.stream.function.definition提示未定义
  • 应用启动时抛出错误:Invalid topology: Topology has no stream threads and no global threads, must subscribe to at least one source topic or global table

当前配置内容

Java配置类

@Configuration
@EnableKafka
@EnableKafkaStreams
public class Config {
...

@Bean
Consumer<KStream<String, String>> streamConsumer() {
... }

application.yml配置

spring: 
  cloud.stream.function.definition: streamConsumer
  cloud.stream.bindings.streamConsumer-in-0.destination: input-topic
  cloud.stream.bindings.streamConsumer-out-0.destination: output-topic
  cloud.stream.bindings.streamConsumer.group: stream-consumer-group

补充说明

怀疑是缺少依赖导致,但无法确认;添加以下组件后应用可正常启动:

@Component
public class WordProcessor {

@Autowired
void buildPipeline(StreamsBuilder streamsBuilder) { ... }

内容的提问来源于stack exchange,提问作者acme-j

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.15 11:50:22