Commit Graph

2764 Commits

Author SHA1 Message Date
Artem Bilan
d3de2febc6 Move Milestone to SNAPSHOTs
* Upgrade to `awaitility-4.3.0`
* Upgrade to `mockito-5.16.1`
* Upgrade to `reactor-2025.0.0`
* Upgrade to RabbitMQ AMQP 1.0 Client `0.5.0`
2025-03-17 15:45:35 -04:00
Spring Builds
d34f427231 [artifactory-release] Next development version 2025-03-17 16:30:35 +00:00
Spring Builds
01091f3db0 [artifactory-release] Release version 4.0.0-M2 2025-03-17 16:30:34 +00:00
Artem Bilan
abaae9ca28 Fix Spring Data version to 2025.1.0-M1 2025-03-17 12:11:40 -04:00
Artem Bilan
568b9d854b Move deps to latest Milestones; prepare for release 2025-03-17 12:07:37 -04:00
Artem Bilan
063ae662a6 Fix management-rest-api.adoc for http-client
There is no `com.rabbitmq:http-client` (Hop) dependency anymore.
The `WebClient` is used internally in the project for tests.

Mention `WebClient` sample in the doc instead.

* Fix `broker-configuration.adoc` for the `RabbitAdmin.getQueueInfo()` API
2025-03-17 11:38:01 -04:00
dependabot[bot]
8be6913782 Bump io.projectreactor:reactor-bom from 2024.0.3 to 2024.0.4 (#3023)
Bumps [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) from 2024.0.3 to 2024.0.4.
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2024.0.3...2024.0.4)

---
updated-dependencies:
- dependency-name: io.projectreactor:reactor-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-15 02:33:30 +00:00
dependabot[bot]
1d5c892a1d Bump org.junit:junit-bom from 5.12.0 to 5.12.1 (#3022)
Bumps [org.junit:junit-bom](https://github.com/junit-team/junit5) from 5.12.0 to 5.12.1.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.12.0...r5.12.1)

---
updated-dependencies:
- dependency-name: org.junit:junit-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-15 02:33:14 +00:00
Artem Bilan
346d4a7ddb Upgrade to JUnit 5.12.0 2025-03-14 16:58:03 -04:00
Artem Bilan
84ebd3da46 GH-2919: Add documentation for spring-rabbitmq-client
Fixes: https://github.com/spring-projects/spring-amqp/issues/2919
2025-03-14 16:33:18 -04:00
Artem Bilan
684fac25f2 Fix docs for version 4.0
* Move existing `What's New` to the respective `changes-in-3-2-since-3-1.adoc`
* Add entries for the current version into `What's New`
* Start new `rabbitmq-amqp-client.adoc` chapter
2025-03-13 15:49:44 -04:00
Tran Ngoc Nhan
2cb65d57be GH-3015: Use backtick formatted property in docs
Fixes: #3015

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>

**Auto-cherry-pick to `3.2.x`**
2025-03-13 13:38:39 -04:00
Artem Bilan
ca1174f7d1 GH-3014: Add request/reply support into RabbitAmqpMessageListenerAdapter
Fixes: https://github.com/spring-projects/spring-amqp/issues/3014
2025-03-13 12:00:05 -04:00
Raul Avila
1741803975 GH-3006: Read x-death count in a safer way
Fixes: #3006

We had an issue in our system trying to consume a message from RabbitMQ that contained an `x-death` header, with count value typed as `Integer`. 
This caused a `ClassCastException`.
The reason the count value was an int and not a long is that we were storing headers in an internal database as part of a recovery process, and the typing was slightly changed during serialisation / deserialisation.

* Use  `target.setRetryCount(numberValue.longValue());` in the `DefaultMessagePropertiesConverter` instead of cast to `long`

Signed-off-by: Raul Avila <raul.avila@pagonxt.com>

[artem.bilan@broadcom.com Improve commit message]

**Auto-cherry-pick to `3.2.x`**

Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
2025-03-12 10:43:20 -04:00
Artem Bilan
3ecb055eda Fix bug in the RabbitAmqpListenerTests for consumeIsDone
The logic if the `processQ1AndQ2Data()` listener method is to
collect 10 messages, where one of them is a duplication after `requeue`.
The first `discard` is accepted into `received` result, but the second is
terminated by the exception.
However, `countDown()` in the `finally` block is still called for all the cases.
Therefore, `11` times: 7 for normal data, 1 for `discard`, 2 for `requeue`, and 1 for exception.
2025-03-11 11:05:02 -04:00
Artem Bilan
30efbf7a5b GH-3005: Fix SimpleMLC.killOrRestart for closed AC
Fixes: #3005
Issue link: https://github.com/spring-projects/spring-amqp/issues/3005

The `SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.killOrRestart()`
is also called during application context shutdown.
At this moment we cannot emit events into an application context.
Otherwise, it fails with:
```
Exception in thread "rabbitListenerExecutor1" org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'refreshEventListener': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
```

* Introduce `ObservableListenerContainer.isApplicationContextClosed()`
and call it as additional condition in the `SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.killOrRestart()`
before trying to emit `AsyncConsumerStoppedEvent`

**Auto-cherry-pick to `3.2.x`**

The fix for `3.1.x` requires a slightly different approach via `ContextClosedEvent`
2025-03-10 14:20:22 -04:00
Artem Bilan
b55010f742 GH-3008: Fix SimpleMLC.logConsumerException for warn
Fixes: #3008
Issue link: https://github.com/spring-projects/spring-amqp/issues/3008

The real problem  in consumer (e.g. `ClassCastException` mentioned in the issue)
might be lost if DEBUG logging level is not enabled

* Fix the first condition in the `SimpleMessageListenerContainer.logConsumerException()`
to use  `logger.warn()` as it was before https://github.com/spring-projects/spring-amqp/issues/2278 fix

**Auto-cherry-pick to `3.2.x` & `3.1.x`**
2025-03-10 12:17:53 -04:00
Artem Bilan
6b2ad0dc73 Fix RabbitAmqpUtils.toAmqpMessage() util for to prop
The `messageProperties.getReplyTo()` might be null, so set it into `amqpMessage::to`
only if it is not null

* Add convenient `JavaUtils.acceptOrElseIfNotNull()` for two alternative values
2025-03-10 11:17:07 -04:00
Artem Bilan
b6b61c4cfe Improve RabbitAmqpUtils.toAmqpMessage()
The `RabbitAmqpUtils.toAmqpMessage()` utility is used on the publisher side,
so, it is natural to treat such a message as a reply.
Therefore, the `correlationId` is set to `messageId` of `correlationId` is not present.
The `replyTo` of the Spring message is set into `to` of the AMQP message

* Mention in the `Address` JavaDocs that just `routingKey` can be treated differently by clients
* Fix error message in the `RabbitAmqpMessageListenerAdapter`
2025-03-10 10:29:53 -04:00
dependabot[bot]
355be1ee4c Bump org.testcontainers:testcontainers-bom from 1.20.5 to 1.20.6 (#3003)
Bumps [org.testcontainers:testcontainers-bom](https://github.com/testcontainers/testcontainers-java) from 1.20.5 to 1.20.6.
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.20.5...1.20.6)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-08 02:48:45 +00:00
Artem Bilan
994df8851a Fix race condition in the RabbitAmqpListenerTests
According to the `Collections.synchronizedList()` Javadocs,
it has to be iterated with a `synchronized (list)`.
Otherwise, there is no guarantee that memory barrier for list items is fulfilled.
2025-03-07 11:44:57 -05:00
Artem Bilan
9c0c4e2853 Fix Checkstyle violation in the Javadoc 2025-03-06 15:59:55 -05:00
Artem Bilan
0e011878f5 GH-3002: Add RPC support to RabbitAmqpTemplate
Fixes: https://github.com/spring-projects/spring-amqp/issues/3002

* Implement `sendAndReceive` & `receiveAndReply` operations in the `RabbitAmqpTemplate`
* Expose contracts to the `AsyncAmqpTemplate`
* Some NullAway fixes for `AsyncAmqpTemplate` hierarchy
* Move DLQ objects for testing to the common `RabbitAmqpTestBase`
2025-03-06 15:51:04 -05:00
Artem Bilan
434410f503 GH-2991: Extract AmqpConnectionFactory abstraction
Fixes: https://github.com/spring-projects/spring-amqp/issues/2991

It turns out to be not very convenient when application fails on initialization due to not having connection with the broker.
So, the `AmqpConnectionFactoryBean` is wrong contract and better look into a `ConnectionFactory` abstraction instead.

* Rework `AmqpConnectionFactoryBean` with its eager real connection to the `AmqpConnectionFactory` contract and
`SingleAmqpConnectionFactory` implementation where real connection only happens when its `getConnection()` is called
* Rework all the client components to rely on the new `AmqpConnectionFactory` contract
* Make `Publisher` instantiation in a similar to `Connection` manner - on demand, when `RabbitAmqpTemplate` calls its internal `getPublisher()`
2025-03-04 15:25:41 -05:00
dependabot[bot]
b90b672ff7 Bump ch.qos.logback:logback-classic from 1.5.16 to 1.5.17
Bumps [ch.qos.logback:logback-classic](https://github.com/qos-ch/logback) from 1.5.16 to 1.5.17.
- [Release notes](https://github.com/qos-ch/logback/releases)
- [Commits](https://github.com/qos-ch/logback/compare/v_1.5.16...v_1.5.17)

---
updated-dependencies:
- dependency-name: ch.qos.logback:logback-classic
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-04 14:24:30 -05:00
dependabot[bot]
c87cd0f60d Bump com.uber.nullaway:nullaway in the development-dependencies group
Bumps the development-dependencies group with 1 update: [com.uber.nullaway:nullaway](https://github.com/uber/NullAway).


Updates `com.uber.nullaway:nullaway` from 0.12.3 to 0.12.4
- [Release notes](https://github.com/uber/NullAway/releases)
- [Changelog](https://github.com/uber/NullAway/blob/master/CHANGELOG.md)
- [Commits](https://github.com/uber/NullAway/compare/v0.12.3...v0.12.4)

---
updated-dependencies:
- dependency-name: com.uber.nullaway:nullaway
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: development-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-04 14:22:57 -05:00
dependabot[bot]
158243e76d Bump com.fasterxml.jackson:jackson-bom from 2.18.2 to 2.18.3
Bumps [com.fasterxml.jackson:jackson-bom](https://github.com/FasterXML/jackson-bom) from 2.18.2 to 2.18.3.
- [Commits](https://github.com/FasterXML/jackson-bom/compare/jackson-bom-2.18.2...jackson-bom-2.18.3)

---
updated-dependencies:
- dependency-name: com.fasterxml.jackson:jackson-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-04 14:22:42 -05:00
Artem Bilan
3d5a6a9766 GH-3001: Add consume batch support to RabbitAmqpListenerContainer
Fixes: https://github.com/spring-projects/spring-amqp/issues/3001

* Expose batch related options for `RabbitAmqpListenerContainer` and `RabbitAmqpListenerContainerFactory`, respectively
* `batchSize` - the indicator that `RabbitAmqpListenerContainer` (and `RabbitAmqpMessageListenerAdapter`) has to work in batch mode
* `batchReceiveTimeout` - how long to wait for batch to be fulfilled or release whatever was gathered so far, even if just only one message
* `taskScheduler` - schedule "force batch release" after `batchReceiveTimeout`
* Make `MessagingMessageListenerAdapter` `final` properties as `protected` to avoid undesired copy-paste burden
2025-03-04 14:20:58 -05:00
Artem Bilan
6402004702 GH-2994: Add tests for RabbitAmqpListenerContainer
Fixes: https://github.com/spring-projects/spring-amqp/issues/2994

* Add `@RabbitListener` tests for `RabbitAmqpMessageListener`
* Adjust `RabbitAmqpMessageListener` error handling logic to call `errorHandler` first
* Move `consumer.pause()` for `RabbitAmqpMessageListener.stop()` to the `supplyAsync()`
to initiate pause for all consumers in parallel
* Expose a failed `message` to the `ListenerExecutionFailedException` from the `RabbitAmqpMessageListenerAdapter`
* Ensure RabbitMQ objects are deleted in the end of tests
2025-03-03 15:16:58 -05:00
Artem Bilan
5be96cb920 GH-2994: Add RabbitAmqpListenerContainer infrastructure
Related to: https://github.com/spring-projects/spring-amqp/issues/2994

* Add `RabbitAmqpMessageListener` for RabbitMQ AMQP 1.0 native message consumption
* Add `RabbitAmqpMessageListenerAdapter` for `@RabbitLister` API
* Add `RabbitAmqpListenerContainer` and respective `RabbitAmqpListenerContainerFactory`
* Add `AmqpAcknowledgment` as a general abstraction.
In the `RabbitAmqpListenerContainer` delegates to the `Consumer.Context` for manual settlement
* Extract `RabbitAmqpUtils` for conversion to/from AMQP 1.0 native message
* Add convenient `ContainerUtils.isImmediateAcknowledge()` and `ContainerUtils.isAmqpReject()` utilities
* Expose `AmqpAcknowledgment` as a `MessageProperties.amqpAcknowledgment` for generic `MessageListener` use-cases
* Remove `io.micrometer` dependecies from the `spring-rabbitmq-client` module since metrics and observation handled
thoroughly in the `com.rabbitmq.client:amqp-client`

Not tests for the listener yet.
Therefore no fixing for the issue.
2025-02-28 17:34:55 -05:00
Artem Bilan
6f0a3380b8 Move some of RabbitAmqpTemplate method up to AsyncAmqpTemplate
* Improve Client module tests
2025-02-26 16:58:51 -05:00
Artem Bilan
d64596951a Fix QueueParserIntegrationTests for long of message_count 2025-02-26 13:25:56 -05:00
Artem Bilan
f486a30e63 Introduce spring-rabbitmq-client for RabbitMQ AMQP 1.0
Fixes: https://github.com/spring-projects/spring-amqp/issues/2991
Fixes: https://github.com/spring-projects/spring-amqp/issues/2992
Fixes: https://github.com/spring-projects/spring-amqp/issues/2993

* Add `QueueInformation.type` since RabbitMQ AMQP Client exposes such an info
2025-02-26 13:13:15 -05:00
dependabot[bot]
fbd93a9dfb Bump org.testcontainers:testcontainers-bom from 1.20.4 to 1.20.5
Bumps [org.testcontainers:testcontainers-bom](https://github.com/testcontainers/testcontainers-java) from 1.20.4 to 1.20.5.
- [Release notes](https://github.com/testcontainers/testcontainers-java/releases)
- [Changelog](https://github.com/testcontainers/testcontainers-java/blob/main/CHANGELOG.md)
- [Commits](https://github.com/testcontainers/testcontainers-java/compare/1.20.4...1.20.5)

---
updated-dependencies:
- dependency-name: org.testcontainers:testcontainers-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-24 08:56:49 -05:00
dependabot[bot]
f5c64ee14b Bump io.micrometer:micrometer-tracing-bom (#2989)
Bumps [io.micrometer:micrometer-tracing-bom](https://github.com/micrometer-metrics/tracing) from 1.5.0-M2 to 1.5.0-SNAPSHOT.
- [Release notes](https://github.com/micrometer-metrics/tracing/releases)
- [Commits](https://github.com/micrometer-metrics/tracing/commits)

---
updated-dependencies:
- dependency-name: io.micrometer:micrometer-tracing-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-22 02:41:55 +00:00
dependabot[bot]
6685f16561 Bump org.springframework:spring-framework-bom (#2988)
Bumps [org.springframework:spring-framework-bom](https://github.com/spring-projects/spring-framework) from 7.0.0-M2 to 7.0.0-SNAPSHOT.
- [Release notes](https://github.com/spring-projects/spring-framework/releases)
- [Commits](https://github.com/spring-projects/spring-framework/commits)

---
updated-dependencies:
- dependency-name: org.springframework:spring-framework-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-22 02:39:39 +00:00
dependabot[bot]
6504e76f04 Bump org.springframework.data:spring-data-bom (#2987)
Bumps [org.springframework.data:spring-data-bom](https://github.com/spring-projects/spring-data-bom) from 2025.1.0-M1 to 2025.1.0-SNAPSHOT.
- [Release notes](https://github.com/spring-projects/spring-data-bom/releases)
- [Commits](https://github.com/spring-projects/spring-data-bom/commits)

---
updated-dependencies:
- dependency-name: org.springframework.data:spring-data-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-22 02:39:19 +00:00
dependabot[bot]
f951ea5bb6 Bump io.micrometer:micrometer-bom from 1.15.0-M2 to 1.15.0-SNAPSHOT (#2986)
Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.15.0-M2 to 1.15.0-SNAPSHOT.
- [Release notes](https://github.com/micrometer-metrics/micrometer/releases)
- [Commits](https://github.com/micrometer-metrics/micrometer/commits)

---
updated-dependencies:
- dependency-name: io.micrometer:micrometer-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-22 02:37:59 +00:00
Tran Ngoc Nhan
2ce61f17d1 Improve build.gradle for building Antora
* Also fix docs for respective `javadoc:` macros

Signed-off-by: Tran Ngoc Nhan <ngocnhan.tran1996@gmail.com>
2025-02-21 12:03:51 -05:00
Artem Bilan
a446e33c14 Fix ci-snapshot.yml for latest reusable workflows
Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
2025-02-20 06:08:48 -05:00
Artem Bilan
27371ecf7c Add tentative manual-deploy-to-central.yml 2025-02-18 16:20:56 -05:00
Spring Builds
8178de7047 [artifactory-release] Next development version 2025-02-18 19:02:42 +00:00
Spring Builds
73cfb9615c [artifactory-release] Release version 4.0.0-M1 2025-02-18 19:02:42 +00:00
Artem Bilan
6cb184e6dc Make verify-staged-artifacts.yml "success" temporary
Until Spring Integration `7.0`
2025-02-18 13:39:55 -05:00
Artem Bilan
fb6ee50ac7 Add deprecated methods to the CorrelationData.Confirm
Java `record` does not come with getters, so migrating POJO to `record`
is not backward compatible
2025-02-18 13:10:14 -05:00
Artem Bilan
d87c21cada Move to latest milestones; prepare for release 2025-02-18 12:50:52 -05:00
Artem Bilan
352072176b GH-2978: Expose some getters for AbstractMessageListenerContainer
Fixes: #2978
Issue link: https://github.com/spring-projects/spring-amqp/issues/2978

**Auto-cherry-pick to `3.2.x` & `3.1.x`**
2025-02-18 12:19:22 -05:00
dependabot[bot]
0e24d401a7 Bump io.projectreactor:reactor-bom from 2024.0.2 to 2024.0.3 (#2967)
Bumps [io.projectreactor:reactor-bom](https://github.com/reactor/reactor) from 2024.0.2 to 2024.0.3.
- [Release notes](https://github.com/reactor/reactor/releases)
- [Commits](https://github.com/reactor/reactor/compare/2024.0.2...2024.0.3)

---
updated-dependencies:
- dependency-name: io.projectreactor:reactor-bom
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-02-14 15:44:11 +00:00
Artem Bilan
b7d9caa860 Bring back 3.1.x branch into Dependabot management 2025-02-14 10:39:53 -05:00
Artem Bilan
4deb40c0fa GH-2941: Fix BlockingQueueConsumer race condition on cancel
Fixes: #2941
Issue link: https://github.com/spring-projects/spring-amqp/issues/2941

Now `BlockingQueueConsumer.basicCancel()` performs `RabbitUtils.closeMessageConsumer()`
to initiate `basicRecovery` on the transactional consumer to re-queue all the un-acked messages.
However, there is a race condition when one in-flight message may still be delivered
to the listener and then TX commit is initiated.
There a `basicAck()` is initiated.
However, such a tag might already be discarded because of the previous `basicRecovery`.
Therefore, adjust `BlockingQueueConsumer.commitIfNecessary()` to skip `basicAck()` if locally transacted and already cancelled.
Right, this may lead to the duplication delivery, but having abnormal shutdown situation we cannot guarantee that this message
to commit has been processed properly.
Also, adjust `BlockingQueueConsumer.nextMessage()` to rollback a message if consumer is canceled instead of
going through the loop via listener

* Increase `replyTimeout` in the `EnableRabbitReturnTypesTests` for resource-sensitive builds
2025-02-13 12:47:53 -05:00