Currently, the `SimpleMessageListenerContainer` is stopped immediately
when `cancelOK` is received.
The expectation do not stop an application context until all the fetched
messages are processed.
Therefore, move `this.activeObjectCounter.release(this);` to the `BlockingQueueConsumer.nextMessage()`
if the internal queue is empty and `cancelled` has been requested.
* Adjust all the SMLC tests for a shorter `receiveTimeout` to not have blocking for nothing
* Fix `EnableRabbitIntegrationTests.exec1` bean for `setAcceptTasksAfterContextClose(true)`.
Looks like an `Executor` can be stopped by the application context before listener container
is able to schedule its shutdown
* Also add `System.setProperty("spring.amqp.deserialization.trust.all", "true");` to be
able to run tests from IDE
**Cherry-pick to `3.0.x`**
- a checkstyle bug prevented detection of javadoc tag ordering
- `allowMissingJavadoc` is no longer available on `JavadocMethod`
(replaced by `MissingJavadocMethod`)
Resolves https://github.com/spring-projects/spring-amqp/issues/1226https://github.com/spring-projects/spring-amqp/issues/1157 changed the way we spy
listeners - to support CGLIB proxies (e.g. `@Transactional`).
Instead of spying the listener, it mocks the listener and sets a default answer
to call the real method on the delegate.
This broke when users used other answers, such as those provided by the framework.
Change the provided answers to subclass `ForwardsInvocation`.
Also fix `ConcurrentModificationException` in `getExceptions()`.
**cherry-pick to 2.2.x, 2.1.x**
* GH-891 Introduced MultiRabbit for handle multiple brokers
* GH-891 Fixed formatting and conventions
* GH-891 Avoid premature load of factory beans and some minor refactoring
* GH-891 Introduced tests for SpringMultirabbit
* GH-891 Modified BPP to return list of Declarables created
* GH-891 Minor refactoring
* GH-891 Updated copyright year
* GH-891 Introduced default setAdminsThatShouldDeclare() into Declarable
* GH-891 Avoiding premature instantiation of RabbitAdmin by providing the bean name instead
* GH-891 Changed to non-default
* GH-891 Removed MultiRabbitBootstrapConfiguration and its test
Resolves https://github.com/spring-projects/spring-amqp/issues/1157
CGLib proxies due to e.g. declarative transactional semantics couldn't
be spied upon due to being final. Replacing the spy, which tries to hold
the state itself, with a mock that delegates execution fixes this.
Resolves https://github.com/spring-projects/spring-amqp/issues/1190
- Remove reference to `Assume` in `BrokerRunningSupport`
- Move example test cases to a new package so they can be easily copied/pasted
- Remove `assumeOnline` field - it looks like it was intended to support running
tests only if RabbitMQ is NOT running; but there was never any way to set it
to false
**cherry-pick to 2.2.x**
* GH-973: Higher order for RabbitListTestBootstrap
Fixes https://github.com/spring-projects/spring-amqp/issues/973
When we use `@EnableRabbit` and `@RabbitListenerTest` in the same
configuration set, e.g. mixing real `@Configuration` and test one for
`@RabbitListenerTest`, we may end up with the case when `@EnableRabbit`
is processed before `@RabbitListenerTest`, so, `RabbitListenerTestHarness`
bean is not going to appear in the application context.
* Implement a `DeferredImportSelector` with an `@Order` for the
`@EnableRabbit` as well as `RabbitListenerTest` giving higher order to
the `RabbitListenerTestSelector`, so `RabbitListenerTestBootstrap` is
processed and register its `RabbitListenerTestHarness` earlier, than it
is done by the `RabbitBootstrapConfiguration`
**Cherry-pick to 2.1.x**
* * Fix Checkstyle
* Add JavaDocs to new classes
Fixes https://github.com/spring-projects/spring-amqp/issues/973
When we use `@EnableRabbit` and `@RabbitListenerTest` in the same
configuration set, e.g. mixing real `@Configuration` and test one for
`@RabbitListenerTest`, we may end up with the case when `@EnableRabbit`
is processed before `@RabbitListenerTest`, so, `RabbitListenerTestHarness`
bean is not going to appear in the application context.
* Override `getOrder()` for the `RabbitListenerTestHarness` to give it
higher priority than regular `RabbitListenerAnnotationBeanPostProcessor`,
so it is registered first and then the last one won't override existing
bean
**Cherry-pick to 2.1.x**
* GH-914: Honor AllowBeanDefOverriding = false
Fixes https://github.com/spring-projects/spring-amqp/issues/914
* Rework `RabbitBootstrapConfiguration` into the `ImportBeanDefinitionRegistrar`
and check for bean definitions presence it is going to register.
This way an override from the `RabbitListenerTestBootstrap` is going to
have a precedence and its `RabbitListenerTestHarness` won't allow a
regular `RabbitListenerAnnotationBeanPostProcessor` to be registered
* Rework `TestRabbitTemplate` to gather all the listener container
from the `ContextRefreshedEvent` instead of the `SmartInitializingSingleton`.
Looks like Spring doesn't care about their order, therefore we need to
be sure that `RabbitListenerAnnotationBeanPostProcessor` has populated
its `registry` with containers before.
* Demonstrate that `allowBeanDefinitionOverriding = false` works well
now in the `ExampleRabbitListenerCaptureTest`
* Optimize `checkTestConfigs` and `updateCopyrights` Gradle tasks for
their `inputs` and `outputs` for better `UP-TO-DATE` handling
**Cherry-pick to 2.1.x without `build.gradle` changes**
* * Fix typo in the `ExampleRabbitListenerCaptureTest`
The introduction of `ClosingRecoveryListener` introduced a tangle between
`connection` and `support`.
Move all channel-related classes from `support` to `connection`.
JIRA: https://jira.spring.io/browse/AMQP-798
Also update amqp-client to 5.2.0
Don't use `MessageConverter` in `Message.toString()` (cycle)
Fix cycle between template and admin (via containers)
Fix outbound reference from support to connection
Fix cycle between connection and listener via RabbitUtils
Fix cycle between listener and core via ChannelAwareMessageListener and admin
Fix cycle between listener.adapter and listener via RabbitListenerErrorHandler
Fix cycle between amqp.support and amqp.core via Correlation
Fix cycle between listener and transaction via ListenerFailedRuleBasedTransactionAttribute
Fix Tests
Polishing - PR Comments; rename schema
Test polishing - travis failures
Polishing according PR comments
* Update Copyright for all affected classes
* Optimize `DirectMessageListenerContainer.checkMissingQueues()` to
cache `amqpAdmin` from the locally created
* `RabbitUtils.DEFAULT_PORT` as not-used and deprecated in `2.0.x`
* Remove commented test in the `LogAppenderUtils`
* Deprecate `AbstractAdaptableMessageListener#setRabbitAdmin()` in favor
of newly introduced `setAmqpAdmin()`
JIRA: https://jira.spring.io/browse/AMQP-670
Initial PoC.
`TestRabbitTemplate` invokes the listener on the calling test thread.
Polishing - support other listener containers, and broadcast (fanout simulation).
Docs and remove reference to fanout since broadcasting does not simulate fanout.
Remove broadcast flag.
Polishing
More Polishing
JIRA: https://jira.spring.io/browse/AMQP-678
Convert `BrokerRunning` to use the amqp-client directly to avoid circular reference.
Also `LongRunningIntegrationTest`.
Polishing - PR Comments
Private inner classes with a private ctor (real or implied) cause the compiler
to generate synthetic package-visibility ctors, with a synthetic class parameter if needed.
Also a few more lambdas.
Avoid empty CTORs to avoid Sonar complaints.