1

Trying to develop a microservices project using the spring-cloud-stream-rocketmq. I have the default rocketmq server and my configuration is

  spring:
  cloud:
    stream:
      default-binder: rocketmq
      rocketmq:
        binder:
          name-server: nameserver1
        bindings:
          output1:
            producer:
              transactional: false
      bindings:
        output1:
          destination: topic1
        output2:  
          destination: topic2

But not i want to access another rocketmq server .How should i change the configuration to use both rocketmq server.Please help me

neng zhang
  • 11
  • 1

2 Answers2

0

multiple nameserver means you are using a cluster!

The configs of broker should be seted properly too

use clustername or try "nameserverIP1;nameserverIP2"

-1
server:
  port: 10086
spring:
  cloud:
    stream:
      default:
        producer:
          use-native-encoding: true
        consumer:
          use-native-encoding: true
      binders:
        binder1:
          type: rocketmq
          environment:
            spring.cloud.stream.rocketmq:
              binder:
                name-server: localhost:9876
                #          accessKey: skXXXX
                #          secretKey: skXXXX
                enable-msg-trace: false
                group: demo-group-1
              bindings:
                topic-demo-out-0:
                  producer:
                    group: delayed-group
                    #必须要设置sync为true,延迟消息才会生效
                    sync: true
                handleDemoMsg-in-0:
                  consumer:
                    enable: true
                    broadcasting: false
                    orderly: false
                handlePaymentCompletedMsg-in-0:
                  consumer:
                    enable: true
                    broadcasting: false
                    orderly: false
        binder2:
          type: rocketmq
          environment:
            spring.cloud.stream.rocketmq:
              binder:
                name-server: localhost:9876
                #          accessKey: akXXXX
                #          secretKey: skXXXX
                enable-msg-trace: false
                group: demo-group-2
              bindings:
                topic-demo2-out-0:
                  producer:
                    group: delayed-group
                    #必须要设置sync为true,延迟消息才会生效
                    sync: true
      default-binder: binder1
      bindings:
        topic-demo-out-0:
          destination: topic-demo
        topic-demo2-out-0:
          destination: topic-demo2
          binder: binder2
        handleDemoMsg-in-0:
          content-type: application/json
          destination: topic-demo
          group: demo-group-1
      function:
        definition: handleDemoMsg,handlePaymentCompletedMsg
Marco
  • 2,368
  • 6
  • 22
  • 48
  • What is this? It’s not clear that it’s an attempt to answer the question. If it is, please [edit] it to format for readability and add an explanation of what you’re doing and why you believe it solves the problem. – Jeremy Caney Jul 31 '23 at 00:02