spring - 如何在带有 Kotlin 的 Spring RabbitMQ 中使用多个消费者绑定
问题描述
这是一个 Kotlin REST API 项目。这是 application.yml
cloud:
stream:
bindings:
eventStateOne-in-0:
destination: eventStateOne-events
binder: rabbit_mq
group: eventStateOne_sub
eventStateOneConsumer-out-0:
destination: eventOne-events
binder: rabbit_mq
group: eventOneConsumer
eventStateTwo-in-0:
destination: eventStateTwo-events
binder: rabbit_mq
group: eventStateTwo_sub
eventStateTwoConsumer-out-0:
destination: eventTwo-events
binder: rabbit_mq
group: eventTwoConsumer
binders:
rabbit_mq:
type: rabbit
environment:
spring:
rabbitmq:
host: <host>
port: <port>
username: <name>
password: <pass>
在代码中,我有 2 个 bean
@Bean
fun eventStateOneConsumer(): Consumer<EventState>
@Bean
fun eventStateTwoConsumer(): Consumer<EventState>
每个 bean 都应该处理 eventStateOne-in-0 和 eventStateTwo-in-0 队列中的消息。当我启动应用程序时,它显示错误
Can't determine default function definition. Please use 'spring.cloud.function.definition' property to explicitly define it.
我知道有 2 个相同类型的 bean,应用程序不知道应该使用哪种类型,但我不知道如何解决这个问题。请帮我解决这个问题
解决方案
推荐阅读
- google-analytics - 谷歌分析页面跟踪停止工作
- java - 400 错误请求。在 JMeter 中测试的 Java 中发送 HTTP POST 调用
- reactjs - 设置“选择文件”按钮的样式
- angular - 自动调整 mat-header-cell 中的输入宽度
- python - python中R的“制表”和“C”的等价物
- php - 为什么刀片指令仍然可见?
- vue.js - vue-chartjs 圆环图百分比显示
- docker - 当 Docker 共享文件夹抛出实例时它是如何工作的。我们是否应该考虑对一个文件抛出容器进行并发修改?
- ansible-galaxy - 使用 enix.mongodb Ansible Galaxy 角色安装特定的 MongoDB 版本
- python - 在 pytube 模块问题中解压的值太多