我正在将Spring云流与RabbitMQ一起使用。
我希望能够从源代码而不是从属性文件(如他们在文档中提到的那样)配置消息和查询属性。
例如,使用用于RabbitMq的经典Java客户端,我可以执行类似的操作来创建具有所需属性的队列:
//qName, passive, durable, exclusive auto-delete
channel.queueDeclare("myQueue", true, false, false, , false , null);
关于如何使用Spring Cloud Stream实现相同功能的任何想法?
答案 0 :(得分:0)
在“ application.yml”内部,您可以添加所有这些值,以下是示例
spring:
cloud:
stream:
instance-count: 1
bindings:
input:
consumer:
concurrency: 2
maxAttempts: 1
group: geode-sink
destination: jdbc-event-result
binder: rabbit
rabbit:
bindings:
input:
consumer:
autoBindDlq: true
republishToDlq: true
requeueRejected: false
rabbitmq:
username: ur-user-name
password: ur-password
host: rabbitmq-url-replace-here
port: 5672
datasource:
platform: mysql
url: jdbc:mysql-url-replace-here
username: ur-user-name
password: ur-password
driverClassName: com.mysql.jdbc.Driver
datasource:
tomcat:
max-wait: 300
min-idle: 10
max-idle: 100
aggregator:
groupCount: 2
batchSize: 1000
batchTimeout: 1000
已更新: