57 Commits

Author SHA1 Message Date
Spring Builds
8416c07442 Update Copyright to -present instead of current year
* Remove unnecessary anymore Gradle `updateCopyrights`
2025-06-16 15:55:12 -04:00
David Horak
0729a57fc6 Add convenient StreamListenerContainer.getStreamName()
It would be nice to have `StreamListenerContainer.getStreamName()` method to fulfill need to dynamically stop/start listeners in reaction of broker events.

Let's say I need to react to RabbitMQ broker events of queue.created / queue.deleted and I need to start and stop listeners, which are assigned to these streams. 
Currently I need to create an extra map of `listenerId` to `streamName` OR include `streamName` in `listenerId` (e.g. `listener:{streamName}`) to be able to carry our operations on listener.

A simple getter for `streamName` on the `StreamListenerContainer` would allow me to react to these changes dynamically without extra code effort.

Signed-off-by: David Horak <horak.david@protonmail.com>

[artem.bilan@broadcom.com: Fix JavaDoc for a new method. Fix Commit message]

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

Signed-off-by: Artem Bilan <artem.bilan@broadcom.com>
2025-02-10 15:46:00 -05:00
Artem Bilan
0173186675 GH-2953: Add NullAway support into the project
Fixes: https://github.com/spring-projects/spring-amqp/issues/2953

* Migrate nullability to JSpecify
* Add `net.ltgt.errorprone` Gradle plugin and respective `NullAway` configuration
* Remove redundant `com.github.spotbugs` since it covered now by the `net.ltgt.errorprone` tool
* Use Java `23` for the latest fixes on Java nullability
* Fix JavaDocs and `this-escape` warnings in the code
* Use `main` for reusable workflows which come already with Java `23`
* Fix all the nullability problems in the project
2025-02-06 15:42:51 -05:00
Artem Bilan
2aaa8db7d0 Migrate imports order to other Spring projects style 2025-01-28 15:44:03 -05:00
Artem Bilan
db59442ea2 Add @DirtiesContext to tests to clean up app ctx cache
And attempt to mitigate out of memory error on CI/CD
2024-12-12 11:22:46 -05:00
Artem Bilan
f150bf531a Make RabbitStreamTemplate.producer as volatile 2024-10-21 17:47:49 -04:00
Tran Ngoc Nhan
33da2a6158 Improve conditions in code
* Reduce `else` condition and modernize switch pattern
* Check condition after calling lock method
* Some additional code clean up
2024-10-21 11:55:36 -04:00
Tran Ngoc Nhan
a597c1574d Modernize more code for diamond, isEmpty & pattern matching 2024-09-30 09:41:46 -04:00
Tran Ngoc Nhan
d7058bbac6 Apply Java pattern matching 2024-09-04 12:20:44 -04:00
Christian Tzolov
c5489e2912 GH-2481: Replace trivial synchronized with locks
Fixes: #2481
2023-12-11 17:22:27 -05:00
Gary Russell
761be85a68 GH-2522: Upgrade to Rabbit Streams 0.14.0
Fixes https://github.com/spring-projects/spring-amqp/issues/2522

The latest `com.rabbitmq:stream-client` has some convenient fixes for
local environment development (including Docker image).

Therefore, fix all the Streams test to use just `.port(streamPort())` option
for the `Environment` instead of custom `addressResolver`
2023-11-06 14:20:01 -05:00
Gary Russell
613c2895ab GH-2552: Fix Builder Argument Types maxLength etc
Resolves https://github.com/spring-projects/spring-amqp/issues/2552

Variables map to Erlang ints which are 8 bytes, so need to be long in Java.
2023-10-31 11:51:18 -04:00
kurenchuksergey
3620f11ebb GH-2540: Add SuperStreamBuilder
Resolves https://github.com/spring-projects/spring-amqp/issues/2540

Usability improvements: New SuperStream builder

builder provide a way to configure:
- maxAge
- maxLength
- maxSegmentSize

Usability improvements: New SuperStream builder

License

Usability improvements: New SuperStream builder

Fix style tests and add a new one for the super stream builder

Usability improvements: New SuperStream builder

Covered x-initial-cluster-size. Fixes after review
2023-10-12 10:10:38 -04:00
Gary Russell
a75b3d0837 GH-2467: Micrometer Observation for Streams
Resolves https://github.com/spring-projects/spring-amqp/issues/2467

* Fix race in test.

* Add tracing test; fix possible NPEs in stream contexts.

* Change input dir for doc generation.

* Strip package from new conventions in gen'd doc.

* Docs; polishing; fix doc generation for duplicate enum values.

* Use stream convention, regardless of native listener or not.
2023-06-01 12:05:54 -04:00
Gary Russell
6b4b908bf4 GH-2451: Add StreamAdmin
Resolves https://github.com/spring-projects/spring-amqp/issues/2451

**cherry-pick to 2.4.x**
2023-05-25 16:29:36 -04:00
Gary Russell
cdcaa6e9a6 Address Sonar Issues 2022-11-02 11:37:48 -04:00
Gary Russell
e7d7244b30 Address Sonar Issues 2022-11-01 14:41:07 -04:00
Gary Russell
8045f2c866 GH-1419: Fix Early Exit in NodeLocator
If a node was returned by the REST call and the node was not in the map
of nodes to addreses, the loop exited early.

The incorrect variable was being tested (never null).

Also add a more sophisticated integration test - using 2 brokers, ensure that
the correct broker is located for the queue.
2022-10-12 15:52:12 -04:00
Gary Russell
c143c5b022 GH-1419: Remove RabbitMQ http-client Usage
Resolves https://github.com/spring-projects/spring-amqp/issues/1419

Use Spring WebFlux instead, while allowing the user to choose some other technology
in the `LocalizedQueueConnectionFactory`.

* Rename DefaultNodeLocator; add generics.
* Remove unnecessary dependencies.
2022-10-11 11:09:51 -04:00
Gary Russell
639eb160ee GH-1444: Observablility Documentation
Resolves https://github.com/spring-projects/spring-amqp/issues/1507

Refactor for latest snapshots; add documentation generation.
Use NOOP registry and supplier for context.

Also fix class tangles.

Disable auto doc generation and polish manually.

* Fix observation of batch listeners; disable more tests temporarily.

* Add remoteServiceName to contexts; fix race in test.

* Add tests for remoteServiceName.

* Set the service name instead of overriding the getter.

* Re-enable tests.

* Switch to Spring Snapshots, Revert "Re-enable tests."

This reverts commit e0a80e372fe0e5954ddc734e2fbbf5aabe457fc9.

* Disable logback adjuster.

* Disable logback appender tests.
2022-10-06 14:14:38 -04:00
Gary Russell
506abd5e9c GH-1509: Add Concurrency for Super Streams
Resolves https://github.com/spring-projects/spring-amqp/issues/1509
2022-10-04 14:59:15 -04:00
Gary Russell
52e49cba80 Fix Stream RabbitListenerTests
- stop container before deleting the streams.
2022-09-28 12:36:25 -04:00
Gary Russell
e0c6568857 Fix AbstractIntegrationTests
Remove system.outs.
2022-09-28 12:16:57 -04:00
Gary Russell
0cce53331a Fix Stream TestContainer
- do not close the container; used by other tests.
2022-09-28 12:14:24 -04:00
Gary Russell
4ee9d21a57 Upgrade stream-client, Docker Image 2022-09-28 09:15:33 -04:00
Gary Russell
732f0da284 GH-1465: Super Stream Support in Template 2022-09-27 11:37:30 -04:00
Gary Russell
62212639c3 GH-1465: Polish Super Stream Javadocs 2022-09-26 16:05:42 -04:00
Gary Russell
094781ecce GH-1465: Add Routing Key Strategy to SuperStream
To support spring-cloud-stream.

* Only include the ordinal in the queue name, not the whole routing key.
2022-09-22 15:31:56 -04:00
Gary Russell
80f8c9c82c GH-1473: Remove Unnecessary Deprecated Interfaces
See https://github.com/spring-projects/spring-amqp/issues/1473
See https://github.com/spring-projects/spring-amqp/issues/1480

Migration interfaces to assist moving to `CompletableFuture` have been
removed from 2.4.x due to Boot auto configuration issues.

Therefore, these interfaces never existed in a released version of 2.4.x.
2022-09-13 11:18:09 -04:00
Artem Bilan
3df0f35597 GH-1465: Re-enable SuperStreamSACTests
Fixes https://github.com/spring-projects/spring-amqp/issues/1465

Turns out the `latest` image has been cached locally and not really actual

We will do respective housekeeping on CI server
2022-09-08 12:47:32 -04:00
Gary Russell
bc01253053 Super Stream is not consumed for some reason 2022-09-08 11:10:12 -04:00
Gary Russell
02f03863b3 GH-1465: Part II - Super Stream SAC
Resolves https://github.com/spring-projects/spring-amqp/issues/1465

Add support for single active consumers on super streams.

Stop containers in test.

Use Snapshot Repo

Use snapshot repo; use TestContainers.
2022-09-07 17:19:16 -04:00
Gary Russell
97644e95e0 Improve Stream Template Test Coverage 2022-08-22 14:13:42 -04:00
Gary Russell
97a508e379 GH-1480: Switch to CompletableFuture in s-r-stream
Resolves https://github.com/spring-projects/spring-amqp/issues/1480

Also reinstate deprecated `AsyncAmqpTemplate2`.
2022-07-28 16:53:42 -04:00
Gary Russell
d143d4b7ae GH-1465: Part 1: Provision Super Streams over AMQP
See https://github.com/spring-projects/spring-amqp/issues/1465

Inspired by 29b1a3eca7/src/test/java/com/rabbitmq/stream/impl/TestUtils.java (L244-L276)

* Docs and Polishing.

- address PR review
- move abstract test class to `support`
2022-06-16 13:18:33 -04:00
Gary Russell
6dae0fc094 Fix Previous Commit 2022-06-16 12:13:54 -04:00
Gary Russell
50624103fa Fix Sonar Issues 2022-06-16 12:10:54 -04:00
Gary Russell
bf32231ad6 GH-1455: AdviceChain on Stream Listener Container
Resolves https://github.com/spring-projects/spring-amqp/issues/1455

Add an advice chain to the stream listener container and its factory.
Add a `StreamMessageRecoverer` for native stream messages.
Add a retry interceptor to work with native stream messages.

**cherry-pick to 2.4.x**

* Add since to new setter.
2022-04-27 10:47:27 -04:00
Gary Russell
42e37cdd67 Upgrade versions; prepare for 2.4.0-M2 2021-09-17 10:22:53 -04:00
Gary Russell
7e3f7bfc56 GH-1352: Docs for RabbitMQ Stream Plugin Support
Resolves https://github.com/spring-projects/spring-amqp/issues/1352
2021-09-17 10:15:15 -04:00
Gary Russell
226e6b5c9f GH-1352: Fix New Sonar Issue 2021-09-15 09:00:23 -04:00
Gary Russell
c3d7624796 GH-1352: StreamRabbitTemplate Improvements
Support for SI `RabbitStreamMessageHandler`, which will live in
the SCSt RabbitMQ binder until SI 6.0 due to versioning.

- expose converters
- use producer message builder if no stream converter provided

* Remove streams before tests; AfterAll has a timing problem.
2021-09-14 13:38:21 -04:00
Gary Russell
2ecde2a282 GH-1352: Add Getter to StreamSendException.confCode 2021-09-09 12:41:01 -04:00
Gary Russell
c9f1b4c81d GH-1352: Fix New Sonar Issues 2021-09-08 12:39:32 -04:00
Gary Russell
cfe842fa63 GH-1352: Add RabbitStreamTemplate
See https://github.com/spring-projects/spring-amqp/issues/1352

Initial commit of Stream Producer support.

* Resolve PR Comments.

* Make TestContainers Optional

* Add test for null-returning MPP - send skipped.

* Fix latch for additional messages sent.

* Remove queues after test.
2021-09-07 15:46:48 -04:00
Gary Russell
b286190efe GH-1352: ConsumerCustomizer Improvements
- pass in the listener id, if available
- narrow to a specific interface to aid Boot auto configuration
- add null check

* Apply Suggestion to add @FuntionalInterface
2021-07-22 15:01:36 -04:00
Gary Russell
3004e1dc61 GH-1352: Fix Possible NPEs 2021-07-20 17:18:06 -04:00
Gary Russell
4c7c3b7831 GH-1352: Checkstyle Fix
Generated `equals()`.
2021-06-24 10:35:28 -04:00
Gary Russell
38e15b669f GH-1352: Fix New Sonar Issues 2021-06-24 09:45:26 -04:00
Gary Russell
7c63133efb GH-1352: RabbitMQ Stream: Map Remaining Properties 2021-06-23 16:21:06 -04:00