Resolves: https://github.com/spring-projects/spring-integration/issues/3199
Previously, the FCCF did not cache a shared connection; if server 1 is down
and server 2 is up, this caused an attempt to connect to server 1 every time
we got the connection.
Add 2 options: `refreshSharedInterval` and `closeOnRefresh`, defaulting to
0 and false respectively, to maintain the same behavior as before the options
existed.
Disallow caching of the single shared connection if the delegate factories are
`CachingClientConnectionFactory` instances.
**cherry-pick to 5.2.x**
I will backport to 5.1.x, 4.3.x after review/merge.
* Polish javadocs and fix typo in docs
- rename from `stopCompletionTimeout`
- add to outbound adapter
- use in both places we disconnect on inbound
**cherry-pick forward to 5.2.x, master**
# Conflicts:
# spring-integration-mqtt/src/main/java/org/springframework/integration/mqtt/outbound/MqttPahoMessageHandler.java
- fix mock tests for internal client changes
- reduce stop wait for completion time
**cherry-pick to 5.2.x**
* Remove stack trace from test and convert to assertJ
* GH-3192: pub-sub DSL for broker-backed channels
Fixes https://github.com/spring-projects/spring-integration/issues/3192
* Introduce a `BroadcastCapableChannel` abstract to indicate those `SubscribableChannel`
implementations which can provide a pub-sub functionality
* Implement a `BroadcastCapableChannel` in broker-baked channels with pub-sub option
* Introduce a `BaseIntegrationFlowDefinition.publishSubscribeChannel()` based
on the `BroadcastCapableChannel` and `BroadcastPublishSubscribeSpec` to let to
configure sub-flow subscribers in fluent manner
* * Add some JavaDocs and document new feature
* * Show the channel bean definition in the doc
* Fix typo
* GH-3180: Add encoding-mode to WS outbound gateway
Fixes https://github.com/spring-projects/spring-integration/issues/3180
* Deprecate `encode-uri` in favor of newly introduced `encoding-mode`
* Add new property to XML and DSL configurations
* Fix tests according a new behavior
* Document the feature
* Fix docs for deprecated `encode-uri`
* Mention also WS from `http.adoc`
* * Fix typos in docs
* GH-3182: Properly reset bean in the MockIntCtx
Fixes https://github.com/spring-projects/spring-integration/issues/3182
The `MockIntegrationContext.resetBeans()` doesn't really restore a state
of endpoint beans: the handle/source is applied only after start for that endpoint
* Stop endpoints in the `MockIntegrationContext.resetBeans()` is they are running currently
* Start them back only if their `autoStartup == true`
* Clear only those beans which names are provided for the `resetBeans()`
**Cherry-pick to 5.2.x**
* * Ensure that only provided beans are reset
Fixes https://github.com/spring-projects/spring-integration/issues/3168
* Call `this.client.noop()` instead of `this.client.isConnected()` to really
check that client has a live connection with the server before calling a `this.client.logout()`
* Wrap `this.client.logout()` into a `try..catch` to be sure that we wil call a
`this.client.disconnect()` even if `logout()` fails for some reason.
* Change `WARN` logs about `Session.close()` into a `DEBUG` level -
when we have a problem with closing session because of server disconnect reason
we have no any control to do with a situation
**Cherry-pick to 5.2.x**
To support `onErrorContinue()` logic for the plain `Subscriber`
we need to wrap its `onNext()` into a `try..catch` and respective
`errorHandler` in the `ReactiveStreamsConsumer`
https://build.spring.io/browse/INT-MASTERSPRING40-978
Investigate a behaviour for `ReactiveStreamsConsumer`
when we use a plain `Subscriber` directly instead of `doOn...` callbacks.
It looks like there is some race condition when the data can be consumed
upstream, but there is no consumer downstream ready yet
Resolves https://github.com/spring-projects/spring-integration/issues/3172
When the listener container supports creating batches of consumed
messages, present the batch as the message payload - either a
`List<Message<?>>` or `List<SomePayload>`.
* Add 'since' to new method.
* GH-3155: Add support for Java DSL extensions
Fixes https://github.com/spring-projects/spring-integration/issues/3155
Provide an `IntegrationFlowExtension` for possible custom EI-operators
in the target project use-cases.
* * Move `IntegrationFlowExtension` tests ot its own test class
* Make all the `IntegrationComponentSpec` ctors as `protected` for possible custom extensions
* Make some `BaseIntegrationFlowDefinition` methods and properties as `protected` to get them
access from the `IntegrationFlowExtension` implementations
* Document the feature
* * Fix language and typos in docs
* * Add `protected` to one more `GatewayEndpointSpec` ctor
* Add JavaDocs to `GatewayEndpointSpec` methods
* * Add `protected` to one more `JmsPollableMessageChannelSpec` ctor
Fixes https://github.com/spring-projects/spring-integration/issues/3169
All other `DefaultSessionFactoryLocator` contracts are based on the `Object`,
so this `addSessionFactor`y has to be on `Object` as well.
* Add `DefaultSessionFactoryLocator.addSessionFactory(Object key, SessionFactory<F> factory)`
* Deprecate existing one based on `String`
* Fix tests do no use a deprecated API
* Some other code style clean up in the affected classes
**Cherry-pick to 5.2.x**
In preparation for: https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/209
When `multiSend` is true and multiple messages are sent as the payload
of a message, each message is sent within the `invoke()` method of the
`RabbitTemplate`.
* Fix javadoc typo
* Fix DSL Spec hierarchy
* Protected CTOR/fields in new and modified specs
* Protected CTORs, fields for remaining AMQP Specs
Fixes https://github.com/spring-projects/spring-integration/issues/3157
* Fixed issue with sequences not being popped when Output processor returns a message.
* Updated documents and added additional Checks to the testcase to ensure proper `popSequence` is done.
* Updated documents and added corrected code formatting
* Updated documents and used headerAccessor Constants for matching headers
* Clean up code style
* Improve docs for the feature on the matter
* Gradle 6.1.1
* MongoDb 4.0
* Other Spring dependencies to `BUILD-SNAPSHOT`
* Fix MongoDb tests according latest Spring Data
* State in the docs that both MongoDb driver are `optional` now in the dependencies
* Populate a JsonHeaders.RESOLVABLE_TYPE on reply
Fixes https://github.com/spring-projects/spring-integration-samples/issues/277
In the `AbstractAmqpOutboundEndpoint` the `JsonHeaders.RESOLVABLE_TYPE`
from request message is copied to reply message making inconsistency downstream.
The `JsonToObjectTransformer` consults first a `JsonHeaders.RESOLVABLE_TYPE`
and deserialize payload to wrong type
* Fix `DefaultAmqpHeaderMapper` to populate a `JsonHeaders.RESOLVABLE_TYPE`
alongside with other `JsonHeaders` populated from the reply AMQP message.
This way a `JsonHeaders.RESOLVABLE_TYPE` from request message won't have effect
* To get access to classes, supply `AbstractHeaderMapper` with a bean factory `ClassLoader`
* Introduce a couple utility methods into `JsonHeaders` for building a `ResolvableType`
**Cherry-pick to 5.2.x**
* * Fix code formatting for arguments wrapping
* GH-3154: Support `UriBuilderFactory.EncodingMode`
Fixes https://github.com/spring-projects/spring-integration/issues/3154
Spring Framework now provides a `DefaultUriBuilderFactory.EncodingMode`
for encoding URIs in the `RestTemplate` before and after uri template
enrichment with uri variables.
Therefore `encodeUri` and manual uri variables substitution is not necessary
in Spring Integration HTTP components
* Deprecate `AbstractHttpRequestExecutingMessageHandler.encodeUri` in favor of
`DefaultUriBuilderFactory.EncodingMode` and respective configuration
on the `RestTemplate` in HTTP module and `WebClient` in WebFlux module
* * Really populate `uriFactory` into an internal `RestTemplate`
* Ensure in tests that `encoding-mode` is populated properly into an internal `RestTemplate`
* Clean up affected HTTP tests for AssertJ and JUnit 5
* * Clean up formatting
* * Apply fix for WebFlux module
* Add docs for new `encoding-mode` option
* * Remove unused import in the test
Fixes https://github.com/spring-projects/spring-integration/issues/3152
The upstream `gatherResultChannel` header has been missed when we produced a reply from nested scatter-gather
Added Test Case for Nested Scatter Gather test
Simplified the the test cases and added author in changed cases
Corrected codestyle issue in Travis CI
Removed additional OriginalReplyChannel and originalErrorChannel in Headers.
Added additional not to be executed line of code in test case.
Restored OriginalErrorChannel Header and removed error handling related fixes
* Clean up code style and improve readability
**Cherry-pick to 5.1.x & master**
* Migrate `RouterTests` to JUnit 5