INT-4226: Fix PollableAmqpChannel.receive(timeout)

JIRA: https://jira.spring.io/browse/INT-4226

Since `rabbitTemplate` properly implement `receive()` with `timeout` it looks organic to delegate a `PollableChannel.receive(timeout)` there.

* Refactor `PollableAmqpChannel` to properly delegate `PollableChannel.receive(timeout)` implementation
* Refactor `ChannelTests` to perform `PollableAmqpChannel.receive(timeout)` directly instead of `Thread.sleep()` loop
* Get rid of `BrokerRunning` in favor of the same rule from the `spring-rabbit-junit` dependency

Doc Polishing

Fix DSL AmqpTests
This commit is contained in:
Artem Bilan
2017-02-22 17:41:06 -05:00
committed by Gary Russell
parent 2d4a7cf92f
commit 257a2d3dab
12 changed files with 79 additions and 201 deletions

View File

@@ -1223,6 +1223,12 @@ IMPORTANT: Just as with other persistence-backed channels, AMQP-backed channels
persistence to avoid message loss.
They are not intended to distribute work to other peer applications; for that purpose, use channel adapters instead.
IMPORTANT: Starting with _version 5.0_, the pollable channel now blocks the poller thread for the specified `receiveTimeout` (default 1 second).
Previously, unlike other `PollableChannel` s, the thread returned immediately to the scheduler if no message was available, regardless of the receive timeout.
Blocking is a little more expensive than just using a `basicGet()` to retrieve a message (with no timeout) because a consumer has to be created to receive each message.
To restore the previous behavior, set the poller `receiveTimeout` to 0.
==== Configuring with Java Configuration
The following provides an example of configuring the channels using Java configuration:

View File

@@ -105,6 +105,9 @@ See <<amqp-delay>> for more information.
The inbound endpoints now support the Spring AMQP `DirectMessageListenerContainer`.
See <<amqp-inbound-channel-adapter>> for more information.
Pollable AMQP-backed channels now block the poller thread for the poller's configured `receiveTimeout` (default 1 second).
See <<amqp-channels>> for more information.
==== HTTP Changes
The `DefaultHttpHeaderMapper.userDefinedHeaderPrefix` property is now an empty string by default instead of `X-`.