简体   繁体   中英

Using Spring Cloud Stream with Rabbitmq, with exchange type “headers”

I have a project configured this way:

spring:
    cloud:
        stream:
            rabbit:
                bindings:
                    myChannel:
                        consumer:
                            prefetch: 3
                            maxPriority: 10
                            exchangeType: headers
            bindings:
                myChannel:
                    destination: MyChannel
                    group: my-channel-readers
                    consumer:
                        concurrency: 4
                        max-attempts: 3
            binders:
                rabbit:
                    type: rabbit

this indeed creates the correct Exchange (as headers) and Queue, but it doesn't bind them.

Before I added the exchangeType: headers it created the exchange as topic and also bound the queue correctly. Also, If I switch it to exchangeType: topic it creates the binding correctly.

I want this to be bound, and to send items only if they have/not have a certain header - how can I do this?

Auto binding to a headers exchange is not currently supported; see the documentation .

exchangeType

The exchange type: direct , fanout or topic for non-partitioned destinations and direct or topic for partitioned destinations.

Default: topic.

Of course, you can bind it manually.

It should be possible to autobind to this type of exchange. Feel free to open a new feature issue on GitHub .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM