526 Commits

Author SHA1 Message Date
Gary Russell
3980b32bd6 Change Defaults
**cherry-pick to 3.0.x, 2.4.x**

(cherry picked from commit 09c612c4ba)

# Conflicts:
#	spring-amqp/src/main/java/org/springframework/amqp/utils/SerializationUtils.java
2023-10-02 12:21:01 -04:00
Gary Russell
429823b0dd Fix minimum Spring, Client versions in docs 2023-09-25 13:26:41 -04:00
Gary Russell
1bc1ae9edf GH-1210: Add Kotlin suspend functions support
* GH-1210: Add Kotlin suspend functions support

Fixes https://github.com/spring-projects/spring-amqp/issues/1210

Kotlin Coroutines are essentially `Future` wrapping.
Therefore, it is natural to have `suspend` support on `@RabbitListener`
methods as we do now for `CompletableFuture` and `Mono`

* Introduce some utilities since we cannot reuse existing from Spring Messaging:
they are there about Kotlin Coroutines only for reactive handlers
* Some code clean up in the `RabbitListenerAnnotationBeanPostProcessor`
for the latest Java
* Add optional dep for `kotlinx-coroutines-reactor` and document the feature
* Fix since javadocs to reflect 2.4.x.

Co-authored-by: Artem Bilan <abilan@vmware.com>
2023-08-31 14:27:13 -04:00
Gary Russell
b98847cd94 GH-2482: Option for Containers to Stop Immediately
Resolves https://github.com/spring-projects/spring-amqp/issues/2482

`forceStop` means stop after the current record and requeue all prefetched.

Just close the channel - canceling the consumer first causes a race condition which
could allow another exclusive or single-active consumer to start processing while
this container is still running.

Also support async stop on DMLC (previously only available on the SMLC).

**cherry-pick to 2.4.x**
# Conflicts:
#	spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/AbstractMessageListenerContainer.java
#	spring-rabbit/src/main/java/org/springframework/amqp/rabbit/listener/DirectMessageListenerContainer.java
2023-07-12 14:59:55 -04:00
Gary Russell
d255671622 GH-2451: Add StreamAdmin
Resolves https://github.com/spring-projects/spring-amqp/issues/2451

**cherry-pick to 2.4.x**
# Conflicts:
#	src/reference/asciidoc/stream.adoc
2023-05-25 16:31:52 -04:00
Gonçalo Montalvão Marques
f1dd2441c5 Fix typo in amqp.adoc 2022-12-14 09:57:18 -05:00
Gary Russell
27f3e54bf4 GH-1541: Fix Container Docs
Resolves https://github.com/spring-projects/spring-amqp/issues/1541

Containers can have zero queues.
2022-11-28 12:16:38 -05:00
Gary Russell
11d4282cd0 GH-1533: Template Receive with Consumer Args
Resolves https://github.com/spring-projects/spring-amqp/issues/1533

Allow setting consumer arguments when using non-zero receive
timeouts using the `RabbitTemplate`.

**cherry-pick to 2.4.x**

# Conflicts:
#	spring-rabbit/src/main/java/org/springframework/amqp/rabbit/core/RabbitTemplate.java
2022-11-15 14:13:58 -05:00
Gonçalo Montalvão Marques
0ff3eb9a32 Fix typo in amqp.adoc 2022-11-15 11:46:21 -05:00
Gary Russell
ddc32a3ae8 GH-1382: Republish Recoverer Improvements
Resolves https://github.com/spring-projects/spring-amqp/issues/1382

Add expressions; make private method protected.

**cherry-pick to 2.4.x**
2022-10-28 14:40:47 -04:00
Gary Russell
b63cd5bd35 GH-1517: Docs and Polishing for Composite Cust. 2022-10-18 09:39:12 -04:00
Gary Russell
6e3e24606f 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.

GH-1419: Add RestTemplateNodeLocator

- also remove hard dependency on `spring-webflux` from `spring-rabbit-junit`.

Fix Javadoc.

Use RestTemplate for aliveness test; JVM HttpClient not available in Java 8.

Restore spring-rabbit-junit jackson dependency.
2022-10-11 15:18:40 -04:00
Gary Russell
2746ebeaca GH-1473: Revert CompletableFuture Changes
See https://github.com/spring-projects/spring-amqp/issues/1473
See https://github.com/spring-projects/spring-amqp/issues/1480

- caused problems with Boot auto configuration
- since 3.0 is a major release, switching to CF there is not onerous
- retain `CompletableFuture` as an async return type
2022-09-13 10:27:59 -04:00
Gary Russell
e8f12b2156 GH-1449: Fix Auto Recovery Docs
Resolves https://github.com/spring-projects/spring-amqp/issues/1449
2022-09-06 15:16:03 -04:00
Artem Bilan
3d3dfa5d70 GH-1491: Support Optional/null Payloads
Resolves https://github.com/spring-projects/spring-amqp/issues/1491

**cherry-pick to 2.4.x**

* Improve connection factory bean in test.
# Conflicts:
#	src/reference/asciidoc/whats-new.adoc
2022-08-09 15:47:55 -04:00
Gary Russell
67bfec93f1 GH-1480: Switch to CompletableFuture in s-r-stream
Resolves https://github.com/spring-projects/spring-amqp/issues/1480
2022-07-28 16:45:08 -04:00
Gary Russell
439ccd174c GH-1473: Switch to CompletableFuture
Resolves https://github.com/spring-projects/spring-amqp/issues/1473

Given the stability of the project, it was simplest to copy the `AsyncRabbitTemplate`
rather than adding a lot of conditional code.

**2.4.x only; I will submit a separate PR for main**
2022-07-27 17:07:18 -04:00
Gary Russell
10f39fbedd GH-1459: Improve MeterRegistry Discovery
Resolves https://github.com/spring-projects/spring-amqp/issues/1459

* Add micrometer properties and container customizers to LCFB.

* Use `ObjectProvider` to locate registry.
2022-05-18 15:48:54 -04:00
Gary Russell
662fb7404b 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:57 -04:00
Yann Bolliger
57bc30fe5d More formatting typos 2022-04-05 10:37:10 -04:00
Yann Bolliger
8bce39d48a Fix typo in amqp.adoc 2022-04-05 10:37:04 -04:00
Leonardo Ferreira
7421de45a1 GH-1434: Mixed CFs With/Without Confirms/Returns
GH-1434 allowing to rabbit template have multiple connection factories with not same confirms and returns flags.

GH-1434 avoiding call obtainTargetConnectionFactory twice

GH-1434 test

GH-1434 javadoc + removing else

GH-1434 fixing checkstyle

GH-1434 using publisherConfirms from PooledChannelConnectionFactory

GH-1434 adapting AbstractRoutingConnectionFactory

GH-1434 javadoc & checkstyle & BeforeEach > BeforeAll

GH-1434 javadoc

GH-1434 doc

GH-1434 doc
2022-03-30 15:30:46 -04:00
Gary Russell
b4e64d9817 GH-1251: Jackson2JsonMessageConverter Improvements
Resolves https://github.com/spring-projects/spring-amqp/issues/1420

- detect and use `charset` in `contentType` when present
- allow Jackson to determine the decode `charset` via `ByteSourceJsonBootstrapper.detectEncoding()`
- allow configuration of the `MimeType` to use, which can include a `charset` parameter

**cherry-pick to main - will require what's new fix**

* Fix typo in doc.
2022-03-09 13:03:39 -05:00
Gary Russell
5621a6b992 GH-1422: @RabbitListener: Fix Broker-Named Queues
Resolves https://github.com/spring-projects/spring-amqp/issues/1422

Broker-named queues did not work with `@RabbitListener` because the BPP
only passed the name of the queue bean, not the bean itself, into the
endpoint.

Support bean injection; fall back to the previous behavior if a mixture
of beans and names are encountered (the containers don't support both
types of configuration).

Add a note to the javadoc to indicate that broker-named queues are not
supported via `queuesToDeclare` and `bindings` properties; such queues
must be declared as discrete beans.

* Docs.

**cherry-pick to `2.4.x` & `2.3.x`**
2022-02-14 12:15:20 -05:00
Muhammad Hewedy
279ca1378a fix multi-rabbit example
RoutingConnectionFactory is not a ConnectionFactory
2022-02-03 09:26:41 -05:00
Gary Russell
fbd444e2f6 Remove declareCollections from Doc
Incorrectly left over after the property was removed in 2.2.
2022-02-01 11:35:54 -05:00
Gary Russell
a4f014dc35 GH-1409: Fix Nacks for Async Replies
Resolves https://github.com/spring-projects/spring-amqp/issues/1409

Normally, when message has a fatal exception (such as message conversion)
`basicNack` with `multiple` true is used, to nack any previously unacked
messages (e.g. when using batch size to limit the ack traffic).
Even when using manual acks, fatal exceptions are nacked by the container
because the user does not have access to the message.

However, when using async replies, this has the side effect of nacking
unprocessed messages.

Detect whether async replies are being used and only nack individual
records that cause fatal exceptions.

Also, coerce the `AcknowledgeMode` to `MANUAL` for such listners.

Add a test for both containers; send a good message followed by a
bad one without actually completing the reply future.
After the exception occurs and the container is stopped, there should
be one messag in the queue.

* Remove warning, deprecation; add docs.

* Docs.

**Cherry-pick to `2.3.x` & `2.2.x`**
2021-12-20 11:44:08 -05:00
Gary Russell
06396d64c8 Fix overview.html & add java 11 conf for tests 2021-12-02 08:44:44 -05:00
Gary Russell
1f6225b73e GH-1383: Deprecate Remoting
Resolves https://github.com/spring-projects/spring-amqp/issues/1383
2021-11-09 16:57:15 -05:00
Gary Russell
c2530c5d8f Remove Incorrect Doc Re Prefetch with MANUAL Acks
This commit b945d1cc02
incorrectly added text about reducing the prefetch to 1 when using manual acks.

While changing it to 1 fixed a test case (`testListenerRecoversFromBogusDoubleAck`) it should
not have been a general recommendation since acking the same message twice is not a valid
situation.

**cherry-pick to all supported branches**
2021-10-12 10:48:03 -04:00
Gary Russell
bb06e92a81 Upgrade checkstyle; fix violations
- a checkstyle bug prevented detection of javadoc tag ordering
- `allowMissingJavadoc` is no longer available on `JavadocMethod`
  (replaced by `MissingJavadocMethod`)
2021-09-27 15:58:27 -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
9dcc6687ed Doc: Add Anchors to Container Properties 2021-09-16 15:54:14 -04:00
Gary Russell
c8663b3748 GH-1365: Recover Manual Declarations
Resolves https://github.com/spring-projects/spring-amqp/issues/1365

* Verify bean definitions are not added to `manualDeclarables`.
2021-09-09 12:14:16 -04:00
Gary Russell
4d2b9b8172 GH-1362: Enable Capture of Tx Synchronization Fail
Resolves https://github.com/spring-projects/spring-amqp/issues/1362

**cherry-pick to 2.3.x**

* Add missing doc changes.

* Fix test to reset flag.
2021-07-16 18:52:50 -04:00
Gary Russell
7a1b8e381b GH-1351: Add MessageProperties for Argument Match
Resolves https://github.com/spring-projects/spring-amqp/issues/1351
2021-06-17 14:40:49 -04:00
Gary Russell
9e77b00bbe Move main branch to 2.4 (#1354)
* Move main branch to 2.4

* New assertj error messages.
2021-06-11 17:56:55 -04:00
Gary Russell
ea97b1179c GH-1347: DMLC Ignored Authentication Failures
Resolves https://github.com/spring-projects/spring-amqp/issues/1347

Container starts and keeps trying to connect instead of honoring
the property.

**cherry-pick to 2.2.x**
2021-06-09 12:07:44 -04:00
Jay Bryant
8e8dda721f Add links to alternate documentation formats (#1348)
* Add links to alternate documentation formats

Link the HTML to the PDF and vice-versa.

* Update src/reference/asciidoc/index.adoc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2021-06-08 17:08:57 -04:00
Gary Russell
96070f6720 GH-1339: Fix RLErrorHandler with Conversion Ex. (#1346)
Resolves https://github.com/spring-projects/spring-amqp/issues/1339

Error handler was not called for conversion exceptions, preventing
the application from returning some error to the caller for request/reply processing.

**cherry-pick to 2.2.x**
2021-06-07 16:05:14 -04:00
Łukasz Tworek
c5ee02d851 Fix a small typo in the documentation (DeclarationCustomizer -> DeclarableCustomizer) (#1342) 2021-06-02 12:52:33 -04:00
Gary Russell
9137a366c5 CachingCF Threading Doc Polishing 2021-05-27 15:41:44 -04:00
Dmitrii Bocharov
c577fbbf31 GH-1295: Validation for @RabbitHandler
Resolves https://github.com/spring-projects/spring-amqp/issues/1295

GH-1295: add custom HandlerMethodArgumentResolver

Signed-off-by: Dmitrii Bocharov <bdshadow@gmail.com>

GH-1295: simplify configuration of argument Validator. Add argument validation support for @RabbitHandler methods

Signed-off-by: Dmitrii Bocharov <bdshadow@gmail.com>

Avoid double payload validation in the listener that has no default handler, when a validator is provided

Signed-off-by: Dmitrii Bocharov <bdshadow@gmail.com>
2021-05-06 13:12:09 -04:00
Gary Russell
e787950364 GH-1312: Correlation on Channel with Direct Reply
Resolves https://github.com/spring-projects/spring-amqp/issues/1312

With Direct Reply-To we can correlate the reply using the channel
instead of requiring the server to echo back the correlation id.

* Fix link in what's new.
2021-05-05 14:20:14 -04:00
Gary Russell
d269a3244e GH-1331: ThreadChannelConnFactory Improvements
Resolves https://github.com/spring-projects/spring-amqp/issues/1331

Provide a mechanism so that a thread can hand off its channel(s) to another thread.
Add protection to close a channel that would be orphaned if a second channel is transferred
to the thread and the thread failed to close its channel beforehand.

Other improvements:

- only call the channel listener when a channel is actually created
- physically close a transactional channel that is no longer in the thread local because
  `closeThreadChannel` was called
- move reset of physical close flag to the actual close

* Suggestions from PR review + other improvements:

- protect against calling 'prepare' when no channels bound
- log warning for unclaimed context switches
- add more tests
2021-04-30 13:20:33 -04:00
Gary Russell
52cb8987cf GH-1329: Document Multi-Threaded Strict Ordering
Resolves https://github.com/spring-projects/spring-amqp/issues/1329
2021-04-28 10:32:57 -04:00
Gary Russell
2cded99e33 GH-1325: Queue API Deprecations and Improvements
Resolves https://github.com/spring-projects/spring-amqp/issues/1325
2021-04-22 15:07:34 -04:00
Artem Bilan
0757aac4f1 Use current main branch in docs instead of master (#1322) 2021-04-15 11:38:07 -04:00
Gary Russell
e190e53dfd GH-1318: Support the Global Flag in basicQos
Resolves https://github.com/spring-projects/spring-amqp/issues/1318

**cherry-pick to 2.2.x**
2021-04-07 17:45:11 -04:00
Gary Russell
866868cd5d Fix link in doc 2021-04-02 14:09:30 -04:00