Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RabbitMQ ERROR: inequivalent arg 'x-queue-type' for queue 'queue-order' in vhost '/': received none but current is the value 'classic' of type 'longstr' #1150

Closed
AmosWong1998 opened this issue Jan 29, 2020 · 3 comments

Comments

@AmosWong1998
Copy link

AmosWong1998 commented Jan 29, 2020

This error is always reported when I start the app.

version

SpringBoot 2.2.2.RELEASE
RabbitMQ 3.8.1.RELEASE

erorr logs:

2020-01-29 18:53:32.752 ERROR 19484 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-queue-type' for queue 'queue-order' in vhost '/': received none but current is the value 'classic' of type 'longstr', class-id=50, method-id=10)
2020-01-29 18:53:33.756 ERROR 19484 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-queue-type' for queue 'queue-order' in vhost '/': received none but current is the value 'classic' of type 'longstr', class-id=50, method-id=10)
2020-01-29 18:53:35.759 ERROR 19484 --- [ 127.0.0.1:5672] o.s.a.r.c.CachingConnectionFactory       : Channel shutdown: channel error; protocol method: #method<channel.close>(reply-code=406, reply-text=PRECONDITION_FAILED - inequivalent arg 'x-queue-type' for queue 'queue-order' in vhost '/': received none but current is the value 'classic' of type 'longstr', class-id=50, method-id=10)

application.yml

spring:
  rabbitmq:
    host: 127.0.0.1
    port: 5672
    username: guest
    password: guest
    virtual-host: /
    listener:
      simple:
        prefetch: 10
        acknowledge-mode: manual 

my consumer service:

@RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(value = "queue-order", durable = "true"),
                    exchange = @Exchange(value = "exchange-order", type = "fanout")
            )
    )
    @RabbitHandler
    @Transactional
    public void handleMessage(@Payload Map<String, Object> data, Channel channel, @Headers Map<String, Object> headers) {
        try {
           //ignore...
            Long tag = (Long) headers.get(AmqpHeaders.DELIVERY_TAG);
            channel.basicAck(tag, false);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

According to the following error report, I guess it may be the problem of the attribute 'x-queue-type'

inequivalent arg 'x-queue-type' for queue 'queue-order' in vhost '/': received none but current is the value 'classic' of type 'longstr'

So I change my consumer service:

@RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(value = "queue-order", durable = "true"),
                    exchange = @Exchange(value = "exchange-order", type = "fanout"),
                   // add arguments attribute
                    arguments = {
                            @Argument(name = "x-queue-type", value = "classic")
                    }
            )
    )

But it doesn't work. It still reports the same error

@AmosWong1998
Copy link
Author

oh, I find my problem, the consumer service should be:

@RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(value = "queue-order", durable = "true", arguments = {
                            @Argument(name = "x-queue-type", value = "classic")
                    }),
                    exchange = @Exchange(value = "exchange-order", type = "fanout")
            )
    )

but why throw this error??

@garyrussell
Copy link
Contributor

garyrussell commented Jan 29, 2020

You should ask questions about RabbitMQ itself on the rabbitmq-users Google Group.

This was a bug in RabbitMQ itself; fixed in 3.8.2.

@AmosWong1998
Copy link
Author

Okey, thank you so much. @garyrussell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants