rabbitmqspring-integrationspring-amqp

spring boot 3 upgrade causing delays in receiving message from rabbit mq


I'm upgrading from Spring Boot 2.7 to Spring Boot 3.3

Mine is spring integration app with libraries : spring-boot-starter-amqp , spring-integration-amqp spring-boot-starter-integration

The application is currently on single consumer.

Using SimpleMessageListenerContainer : AUTO Acknowledgement Mode

When publisher sends to exchange migration.rxo it is quick(microseconds)

When My App sends to exchange (for retry)migration.rxo it takes 5-6 seconds in Spring Boot 2. It is now taking around 35 seconds delay in Spring Boot 3.

My rabbit mq configuration is here :

    {
  "users": [
    {
      "name": "admin",
      "password_hash": "xyz",
      "hashing_algorithm": "pqr",
      "tags": "administrator"
    },
    {
      "name": "user",
      "password_hash": "abc",
      "hashing_algorithm": "mno",
      "tags": ""
    }
  ],
  "vhosts": [
    {
      "name": "/"
    }
  ],
  "permissions": [
    {
      "user": "user",
      "vhost": "/",
      "configure": "",
      "write": ".*",
      "read": ".*"
    },
    {
      "user": "admin",
      "vhost": "/",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }
  ],
  "exchanges": [
    {
      "name": "migration.rxi",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    },
    {
      "name": "migration.rxo",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    },
    {
      "name": "migration.dlx",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    },
    {
      "name": "migration.large.rxi",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    },
    {
      "name": "migration.large.rxo",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    },
    {
      "name": "migration.large.dlx",
      "vhost": "/",
      "type": "direct",
      "durable": false,
      "auto_delete": false,
      "internal": false,
      "arguments": {}
    }
  ],
  "queues": [
    {
      "name": "migration.q",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {
        "x-dead-letter-exchange": "migration.dlx",
        "x-max-length": 10000
      }
    },
    {
      "name": "migration.wq",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {
        "x-dead-letter-exchange": "migration.rxo",
        "x-message-ttl": 15000
      }
    },
    {
      "name": "migration.dlq",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {}
    },
    {
      "name": "migration.large.q",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {
        "x-dead-letter-exchange": "migration.large.dlx",
        "x-max-length": 100000
      }
    },
    {
      "name": "migration.large.wq",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {
        "x-dead-letter-exchange": "migration.large.rxo",
        "x-message-ttl": 15000
      }
    },
    {
      "name": "migration.large.dlq",
      "vhost": "/",
      "durable": false,
      "auto_delete": false,
      "arguments": {}
    }
  ],
  "bindings": [
    {
      "source": "migration.rxi",
      "vhost": "/",
      "destination": "migration.wq",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "source": "migration.rxo",
      "vhost": "/",
      "destination": "migration.q",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "source": "migration.dlx",
      "vhost": "/",
      "destination": "migration.dlq",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "source": "migration.large.rxi",
      "vhost": "/",
      "destination": "migration.large.wq",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "source": "migration.large.rxo",
      "vhost": "/",
      "destination": "migration.large.q",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    },
    {
      "source": "migration.large.dlx",
      "vhost": "/",
      "destination": "migration.large.dlq",
      "destination_type": "queue",
      "routing_key": "",
      "arguments": {}
    }
  ]
}

Solution

  • I found out, for gateways the default timeout has changed from 1000ms to 30000ms.

    Other then that, the solution that worked for me is changing from outbound gateway to outbound adapters.

    Gateway is about request-responseand waits for response whereas adapters is just about send.

    As per my requirements, adapters work well. So, I moved from outbound gateway to outbound adapter.