2
votes

Here it is my part of application properties:

spring.cloud.stream.rabbit.bindings.studentInput.consumer.exchange-type=direct spring.cloud.stream.rabbit.bindings.studentInput.consumer.delayed-exchange=true

But it appears that in the RabbitMQ Admin page, it does not have x-delayed-type: direct in the Args in feature of my queue. I am referencing to this Spring Cloud Stream documentation: https://docs.spring.io/spring-cloud-stream/docs/Elmhurst.RELEASE/reference/htmlsingle/

What am I doing wrong? Thanks in advance :D

1
The x-delayed-type is an exchange feature. It fully isn't related to the queue abstraction.Artem Bilan
See my answer - perhaps the plugin is not installed, or the exchange already exists.Gary Russell

1 Answers

3
votes

I just tested it and it worked fine.

enter image description here

Did you enable the plugin? If not, you should see this in the log...

2018-07-09 08:52:04.173 ERROR 156 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: connection error; protocol method: #method(reply-code=503, reply-text=COMMAND_INVALID - unknown exchange type 'x-delayed-message', class-id=40, method-id=10)

See the plugin documentation.

Another possibility is the exchange already existed. Exchange configuration is immutable; you will see a message like this...

2018-07-09 09:04:43.202 ERROR 3309 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory : Channel shutdown: channel error; protocol method: #method(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'type' for exchange 'so51244078' in vhost '/': received ''x-delayed-message'' but current is 'direct', class-id=40, method-id=10)

In this case you have to delete the exchange first.

By the way, you will need a routing key too; by default the queue will be bound with the topic exchange wildcard #.