Spring cloud stream RabbitMq-从源代码设置属性

问题描述 投票:0回答:1

我正在使用RabbitMQ使用Spring云流。

我希望能够从源代码设置消息和查询属性。

例如,对于经典的RabbitMq Java客户端,我可以执行类似的操作来更改队列属性:

                    //qName,    passive, durable, exclusive  auto-delete
channel.queueDeclare("myQueue", true,    false,   false,   , false       , null);

关于如何使用Spring Cloud Stream实现相同功能的任何想法?

java spring rabbitmq spring-cloud
1个回答
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
© www.soinside.com 2019 - 2024. All rights reserved.