0
votes

I use rabbitmq as the middleware in cloud stream ,when I configure the application.yml

spring:
  cloud:
    stream:
      bindings:
        usertest:       #channelName 
          content-type: application/json
          group: testGroup
          destination: topic888 #destination,
          binder: rabbit1

I can't understand the key meaning of destination. official definition is :

destination

The target destination of a channel on the bound middleware (e.g., the RabbitMQ exchange or Kafka topic). If the channel is bound as a consumer, it could be bound to multiple destinations and the destination names can be specified as comma separated String values. If not set, the channel name is used instead.

Also,I found when consumer and producer have different destinations , It did't stop consumer from consuming.

1

1 Answers

1
votes

The destination depends on the binder type. For kafka, it's the topic; for RabbitMQ, it's an exchange.

The producer publishes to the exchange.

The consumer binds a queue to the exchange. Anonymous consumers bind a temporary, auto-delete queue, consumers with a group bind a queue called topic888.testGroup in your case (destination.group).

Also,I found when consumer and producer have different destinations , It did't stop consumer from consuming.

I don't see how that's possible, with the binder doing the provisioning, for the reasons discussed above.

It's possible if you manually bind a queue with the correct name to a different exchange that the producer is publishing to.