Why does basicReject does not work with Apache Qpid?

a 夏天 提交于 2020-01-15 09:27:13

问题


I'm using qpid-broker for integration testing my spring-boot-start-amqp application which uses basicGet (autoAck=false), basicAck and basicReject for handling the messages. basicReject (with requeue=false) works fine with my external rabbitmq instance but doesn't work with the qpid-broker.

I have tested my code with an external RabbitMQ instance where everything works fine but with the embedded Apache Qpid server the test fails because basicReject is not working properly.

Getting the message and rejecting it:

rabbitTemplate.execute {
    val response = it.basicGet(config.queueName, false)
    it.basicReject(response.envelope.deliveryTag, false)
}

Check if the message is still in the queue:

rabbitTemplate.execute {
    val response = it.basicGet(config.queueName, false)
    Assertions.assertThat(response).isNull()
}

My Qpid config:

{
  "name": "EmbeddedBroker",
  "modelVersion": "7.0",
  "authenticationproviders": [
    {
      "name": "password",
      "type": "Plain",
      "secureOnlyMechanisms": [],
      "users": [
        {
          "name": "guest",
          "password": "guest",
          "type": "managed"
        }
      ]
    }
  ],
  "ports": [
    {
      "name": "AMQP",
      "port": "${qpid.amqp_port}",
      "protocols": [ "AMQP_0_9_1" ],
      "authenticationProvider": "password",
      "virtualhostaliases": [
        {
          "name": "defaultAlias",
          "type": "defaultAlias"
        }
      ]
    }
  ],
  "virtualhostnodes": [
    {
      "name": "default",
      "defaultVirtualHostNode": "true",
      "type": "Memory",
      "virtualHostInitialConfiguration": "{\"type\": \"Memory\" }"
    }
  ]
}

Why does basicReject work fine with my RabbitMQ instance but doesn't work properly with the Apache Qpid embedded broker?

Edit: My solution was to move away from qpid and use a RabbitMQ Testcontainer.

来源:https://stackoverflow.com/questions/57873395/why-does-basicreject-does-not-work-with-apache-qpid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!