JIRA: https://jira.spring.io/browse/INT-4252
To allow to provide arbitrary bean names for the intermediate components
in the `IntegrationFlow` change `ComponentsRegistration` to return
a `Map<Object, String>` instead of raw `Collection<Object>`
* Use the value from that map in the `IntegrationFlowBeanPostProcessor` as a
fallback option before walking into bean name generation
* Provide `containerId` option for the AMQP DSL components
* Revert `@AfterClass` in the `AmqpTests`
* Expose `id()` for the `JmsDestinationAccessorSpec`
* Register `ListenerContainer` and `JmsTemplate`
as bean via `ComponentRegistration` in the particular JMS Java DSL components
* Fix `Jms` factory to populate the `JmsDefaultListenerContainerSpec`
for the `messageDrivenChannelAdapter()` without class specified
* Refactor AMQP DSL Inbound components to deal with the new ContainerSpec API
* Remove `containerId()` in favor of `id()` in the ContainerSpec
JIRA: https://jira.spring.io/browse/INT-4276
The `readOnlyHeaders` integration property allows suppression of certain headers
globally.
Add support for suppressing propagation on individual message handlers.
JIRA: https://jira.spring.io/browse/INT-4245
* Move `ReplyProducingMessageHandlerWrapper` outside of
`ServiceActivatorAnnotationPostProcessor`.
* Use it from the `ServiceActivatorFactoryBean` as well to fix
the missed `Lifecycle` control
* Increase wait timeout in the `ConnectionFactoryTests`
* Mark endpoint as `auto-startup="false"` in the SFTP parser tests
* Remove redundant `org.gradle.daemon=true` from the `gradle.properties`
since it is like that by default for a while already
JIRA: https://jira.spring.io/browse/INT-4274
Since any component from the `StandardIntegrationFlow` can be started
independently, the `StandardIntegrationFlow.stop()` should propagate
the stop control to the target components independently of its previous
`running` state
Javadoc Polishing
JIRA: https://jira.spring.io/browse/INT-4272
- Honor read only header configuration when building from an unchanged message
- Support adding read only headers to the message builder factory
* Move `IntegrationMessageHeaderAccessor.containsReadOnly()` to the
`MessageBuilder` to avoid confusing
**Cherry-pick to 4.3.x**
Since the classes load their imports explicitly we can't use them for
classes which provides utilities to check classpath
* Move imports to fully qualified names in the target utility method
**Cherry-pick to 4.3.x**
Move `JacksonJsonUtils.isPresent` methods to separate `JacksonPresent` class
Polishing
* Rename `ReactiveConsumer` to `ReactiveStreamsConsumer`
* Rename `FluxSubscribableChannel` to `ReactiveStreamsSubscribableChannel`
* Remove the `processor` functionality from the `FluxMessageChannel`
in favor of internal `FluxSink` as it is recommended by the Project Reactor:
> Most of the time, you should try to avoid using a Processor.
They are harder to use correctly and prone to some corner cases.
* Make connectable, upstream publishers for the `FluxMessageChannel` as
bridges to the internal `sink` via `this::send`.
This way we are able to receive data from multi sources.
When the source is completed (e.g. `Mono` in case of WebFlux response),
the downstream flow isn't completed.
* Rework `MessageChannelReactiveUtils#PollableChannelPublisherAdapter`
to be based on the `Flux.create()` and `onRequest()` to poll channel for messages
* Add one more request to the `ReactiveHttpRequestExecutingMessageHandler`
to be sure that we consume different `Mono`s by the `FluxSubscribableChannel`
properly without completion
* Upgrade to the `spring-io-plugin:0.0.7.RELEASE`
Add `IntegrationConsumer` implementation to the `ReactiveStreamsConsumer`
JIRA: https://jira.spring.io/browse/INT-4267Fixes: spring-projects/spring-integration#2110
The documentation clearly point that we can simply use JSON (de)serialization
with the `RedisMessageStore`, but actually it isn't so easy
* Fix `MessageGroupMetadata`, `MessageHolder`, `MessageMetadata` for Jackson
deserialization compatibility
* Add `MessageHeaders`-based ctor to the `AdviceMessage`
* Add `MessageHeadersJacksonSerializer` to serialize `MessageHeaders`
to the `HashMap` for easier deserialization afterwards
* Add deserializer implementations for all `Message` types
* Add convenient `JsonObjectMapperProvider#jacksonMessageAwareMapper()`
factory method to build `ObjectMapper` supplied with mentioned above
(de)serializers
**Cherry-pick to 4.3.10 without `MessageHolder` and `MessageMetadata`**
Address PR comments and document the feature
Doc Polishing
https://build.spring.io/browse/INT-MASTER-653
The test-case uses only 1 second to wait for the message
in the `QueueChannel`.
That isn't enough on slow environment like CI causing failure for
the current test and unexpected value in the queue for the subsequent
tests
* Fix timeouts
* Get rid of `CountDownLatch` - the same is done by the wait on queues
* Purge queue in between tests.
This way we may not have failed subsequent test, thus failure analyze
will be much easier
* Rework `testRollback()` to wait for good result after one retry over
rollback
* Remove duplicate bean definition from XML config
**Cherry-pick to 4.3.x and 4.2.x**
JIRA: https://jira.spring.io/browse/INT-4270
Initial Commit
Remove `final` modifier from certain critical framework methods that prevent CGLib proxies working.
Since Spring Boot 2.0 now uses proxyTargetClass=true by default (and has done that for
transactional proxies since 1.4), we must relax these restrictions so that CGLib can
proxy channels (which is often done to make subflows run in a transaction).
When CGLib can't override a `final` method, the fields used within those methods are uninitialized.
In the case of `AbstractMessageChannel` this causes an NPE on the unitiallized `dataTypes` field.
With `MessageHandler`, fields like `shouldTrack` are always false.
Further, methods on `IntegrationObjectSupport` - such as `getComponentName()` return null.
I have left setters and `afterPropertiesSet` (on IOS) `final` since these will typically be called
before the object is proxied.
I suspect there will be other methods we need to open up, but perhaps we should only do them on-demand.
__cherry-pick to 4.3.x__
JIRA: https://jira.spring.io/browse/INT-4260
MPEH: Populate the `ErrorMessage.originalMessage`,
if available and not the same as the `failedMessage`.
Polishing - rename exception to `MessagingExceptionWrapper`;
make `MPEH` a subclass of `ErrorMessagePublisher`
PR Comments
Polishing - PR Comments
JIRA: https://jira.spring.io/browse/INT-4259
Since DEBUG can switched off for the application, it becomes difficult
to determine the wrong configuration for the discard flow from
the scheduler thread.
* Change logging level to the `WARN` and log the full stack-trace as well
to give more information about the reason of rescheduling group for
`forceComplete`
**Cherry-pick to 4.3.x**
JIRA: https://jira.spring.io/browse/INT-4265
* Add `.routeByError()` EIP-method to the `IntegrationFlowDefinition`
based on the `ErrorMessageExceptionTypeRouter`
* Add missed `dynamicChannelLimit()` option to the `RouterSpec`
* Rework `RouterSpec#RouterMappingProvider` into the `ContextRefreshedEvent`
phase initialization to be sure that dependent `MappingMessageRouterManagement`
is fully initialized before applying mapping conversions
* Rename `routeByError()` to `routeByException()` to more reflect reality
of the `ErrorMessageExceptionTypeRouter` and don't mislead about
Java's `Error`
* Polish `ErrorMessageExceptionTypeRouter` JavaDocs a bit and some Java 8
code style
* Add `ApplicationContext` assertion into the
`RouterMappingProvider.onApplicationEvent()` do not trigger delegate
initialization if `ContextRefreshedEvent` is from the different app context
- as discussed last week
TODO:
- should we take the channel outside of the `AbstractMessageChannel` hierarchy?
- avoid blocking interceptors
- we would lose channel metrics though
- rename `ReactiveConsumer` ?
Polishing some missed renaming
JIRA: https://jira.spring.io/browse/INT-4261
When we have some `Advice` withing TX Advice which may perform `doPoll()`
several times, we unconditionally call
`transactionSynchronizationFactory.create(resource)`.
With the out-of-the-box implementations
`DefaultTransactionSynchronizationFactory` and
`PassThroughTransactionSynchronizationFactory`
we preform `TransactionSynchronizationManager.bindResource()`.
If resource is already there, an `IllegalStateException` is thrown
* Check that resource isn't bound already to the TX and don't create a new
`TransactionalResourceSynchronization` - just return `null`
* Check in the target users for the `null` before registering synchronization
Move resource registration to TX outside of out-of-the-box factories
* Fix condition in the `AbstractPollingEndpoint` for the resource
* Increase responsiveness of TX test to decreasing `fixed-delay`
and using `receive-timeout="-1"`
* Upgrade to Gradle 3.5, SS-5.0, Hibernate-5.2.10, Mockito-2.7.22, Pah-1.1.1
And some other minor upgrades
* Fix deprecations for Mockito compatibility
* Fix `ServletWebSocketHandlerRegistry` deprecations
* Fix SD-Mongo deprecations
* Tweak JMX tests to avoid dangling threads after tests exist
* Increase timeouts in some polling tests
JIRA: https://jira.spring.io/browse/INT-4264
When we use Java DSL `.publishSubscribeChannel()`, we expect that subscribers
will be called in the order they are defined in the flow.
But actually everything is depend on the populated `MessageHandler` implementation.
The `AbstractMessageHandler` implements `Ordered` and according the
`OrderedAwareCopyOnWriteArraySet` logic they are placed in the beginning of the
handlers set, meanwhile all others (un-ordered) are moved to the end.
* Add implicit `.bridge()` to all the subFlows added to the `PublishSubscribeSpec`.
This way all the subFlow subscribers will be ordered the same way (because of
`BridgeHandler`) and, therefore, will be preformed in the expected (as declared) order
JIRA: https://jira.spring.io/browse/INT-4257
So that subclasses can also generate error message for conditions such
as message conversion errors.
Polishing - PR Comments
Fix JMS buildErrorMessage Override
Update Copyrights
JIRA: https://jira.spring.io/browse/INT-4257
* Remove deprecated `EnhancedErrorMessage`
* Document `ErrorMessagePublisher` and `ErrorMessageStrategy`
* Fix Reactor version to `3.1` in Doc
* Fix sample about Reactive Streams in the `router.adoc`
JIRA: https://jira.spring.io/browse/INT-4257
To make a target `ErrorMessage` customizable introduce
`ErrorMessagePublishingRecoveryCallback` and
`ErrorMessageStrategy` to inject
**Cherry-pick to 4.3.x**
Fix `ErrorMessagePublishingRecoveryCallback` generic type for
`RequestHandlerRetryAdvice` compatibility
Polishing
- Support publishing when no retry context is available
- Use a constant for the message context key
Add EnhancedErrorMessage
- contains input message at time of error message generation
- make the default RecovererErrorMessageStrategy public and extensible
Fix `RetryAdviceParserTests` for new `RecoveryCallback` architecture
Rename to `ErrorMessagePublisher`
Decouple ErrorMessagePublisher from Retry
Refactoring for better purpose reflection and JavaDocs
Use `ErrorMessageStrategy` in message producers.
Add JavaDocs to the `DefaultErrorMessageStrategy`
Deprecate EnhancedErrorMessage
Minor Polish for Subclass Use
- make setters final
- allow subclasses to supply the AttributeAccessor
Fix Tests
JIRA: https://jira.spring.io/browse/INT-4254
The `LockRegistryLeaderInitiator#LeaderSelector` unconditional calls
`unlock()` in the `finally` block when the `Lock` might not be locked.
Another problem that `running = true` is set after submitting `LeaderSelector` task.
That might bring the problem that `LeaderSelector` won't be selected because of
`this.running` race condition
* Move `this.running = true` before submitting `LeaderSelector` task
* Move `unlock()` into the `if (this.locked)` condition
**Cherry-pick to 4.3.x**
Using a `LiteralExpression` in the `AbstractRemoteFileOutboundGateway` (when the
user provides a `File` for the directory) causes us to create a new `File` object
each time, instead of using the user-supplied `File`.
Use a `ValueExpression` instead.
Move the `FileWritingMessageHandler` logic to `ExpressionUtils` and use it from both places.
Also add a String setter variant for convenient Java Configuration.
https://build.spring.io/browse/INT-FATS5IC-129/
Since leader selection is done on background thread in the
`LockRegistryLeaderInitiatorTests`, there is no guarantee that
after `Thread.sleep(100)` the lock will be obtained and leader state is
changed.
* Waiting for the `granted` `CountDownLatch` is much robust condition
JIRA: https://jira.spring.io/browse/INT-4208
Since `AsyncRestTemplate` is deprecated in Spring 5.0, it doesn't make
sense to promote that feature via our new `AsyncHttpRequestExecutingMessageHandler`
component
* Rework (and rename) `AsyncHttpRequestExecutingMessageHandler` to
`ReactiveHttpRequestExecutingMessageHandler` and make it based on the
WebFlux `WebClient`
* Fix Java DSL (`ReactiveHttpMessageHandlerSpec`) and all tests according a new
logic in the `ReactiveHttpRequestExecutingMessageHandler`
* Fix XML namespace support to use new `ReactiveHttpRequestExecutingMessageHandler`
and don't expose unused options like `converters` and `request-factory`
* Fix `What's New` and `http.adoc`
* To remain with `async` mode for the `ReactiveHttpRequestExecutingMessageHandler`
behavior support fix `AbstractMessageProducingHandler` to adapt reply `Mono`
to the `SettableListenableFuture`
* Introduce new `reactive` behavior for the `AbstractMessageProducingHandler`
when `outputChannel` is `ReactiveSubscribableChannel` and perform
`.subscribeTo(Publisher)` for `Publisher` reply
* Upgrade to Spring AMQP `2.0 M3`
* Downgrade to Spring Security `4.2.2`
Address PR comments
Add async error handling to the one-way case
Minor polishing and checkstyle fix
According to some rework and deprecations in the latest Reactor,
fix Reactor-based components to follow with the latest paradigmas
* Use `Flux` wrapper in the `ReactiveChannel` to track cancellation
instead of deprecated `Operators.SubscriberAdapter`
* Do similar `Flux.from(publisher)` in the `doSubscribeTo()`
to avoid subscribers delegation and, therefore, unnecessary call stack
* Rework `ReactiveConsumer` to wrap to a new `BaseSubscriber`
on each `ReactiveConsumer.start()`.
We need this wrapping to prevent subscriber cancellation from the
upstream `Publisher` on error.
We can't rely here on the `Flux.retry()` because upstream
`DirectProcessor` is marked as terminated on any error
Apply Reactor-3.0.6.RELEASE
JIRA: https://jira.spring.io/browse/INT-4251
MockIntegration PoC
Demonstrate how `MockIntegration.mockMessageSource()` can be used.
Even from the XML Config!
The same semantics can be applied for any other our mocking features we will add to the `MockIntegration`
Add `testMockMessageSourceDynamicFlow()`
Improve `MockIntegration.Context.instead()` for target bean type assertion
Some refactoring, improvements and JavaDocs
* Move `MockIntegration.Context` to its own `MockIntegrationContext` class
* Rename `@MockIntegrationTest` to `@SpringIntegrationTest` since we talk there not only about mocks, but any other possible testing feature for integration
* Add `@SpringIntegrationTest#stopEndpoints()` attribute for endpoints bean names patterns
* Add `IntegrationEndpointsInitializer` to customize `AbstractEndpoint`s according options from the `@SpringIntegrationTest`
Right now it is only about making them `autoStartup = false`
* Rename `SI-test` to `SI-test-support`
* Rename `SI-mock` to `SI-test`
* Rename `@SpringIntegrationTest#stopEndpoints()` to `noAutoStartup()`
* Fix JavaDocs according PR comments
* Increase timeouts in some sporadically failed tests
* Draft for the `testing.adoc`
Fixesspring-projects/spring-integration-java-dsl#23
Fix `testing.adoc` a bit
* Document Testing Support
* Fix a couple typos in the `xml.adoc`
* Add `package-info.java` files to `/test/` sub-packages
Improve docs according PR comments
Fix typos in `TestUtils` JavaDocs
Add `What's New` note about Java DSL and Testing support
Doc Polishing
JIRA: https://jira.spring.io/browse/INT-4250
When retrieving the mean from `ExponentialMovingAverageRate` or
`ExponentialMovingAverageRatio` via `getStatistics()` the mean did not
decay over time.
The mean did decay when using `getMean()`.
This was caused by the statistics performance refactoring.
JIRA: https://jira.spring.io/browse/INT-4241
To allow `ArrayNode` to be treated as `List` in SpEL expressions, wrap them to the internal `ArrayNodeAsList` implementation
Fix Checkstyle errors
* Add `iterator()` support to the `ArrayNodeAsList`
* Make `HeaderEnricherSpec extends ConsumerEndpointSpec` to avoid extra
EIP-method with two `Consumer`s, when only one for
the `HeaderEnricherSpec` can address all the options - header enricher,
as well as target endpoint
* Move `this.endpointFactoryBean.setHandler(this.handler)` into
the `ConsumerEndpointSpec#doGet()` instead of ctor to avoid
duplicate code from the target implementations (e.g. `BarrierSpec`)
JIRA: https://jira.spring.io/browse/INT-4244
The `JpaOutboundGateway` returns a whole `Message` for reply copying request headers.
Building the reply a `AbstractMessageProducingHandler` uses `MessageBuilder` to create a new `Message` with all request headers because of `shouldCopyRequestHeaders() == true`
* To avoid some overhead with new `Message` and `MessageBuilder` for nothing, just return a JPA result as is and let super class to build the Message
* Optimize all reply producers to return `MessageBuilder` to the super `handleMessage()` process
* Return the whole `gatherResult` `Message<?>` from the `ScatterGatherHandler` to have ability to transfer reply headers as well
* Mark `DelayHandler` as `shouldCopyRequestHeaders() return false` since it doesn't modify Message and returns it as is after delay
JIRA: https://jira.spring.io/browse/INT-4246
The `LockRegistryLeaderInitiator` currently does not revoke leadership
when leading instance is unable to acquire lock from the underlying lock.
This can result in multiple `LockRegistryLeaderInitiator` instances becoming
leaders in the exceptional situations such as lock timeouts.
* Handle leadership revoking when leading `LockRegistryLeaderInitiator`
is unable to acquire lock
Polish javadoc
**Cherry-pick to master**
Conflicts:
spring-integration-core/src/main/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiator.java
spring-integration-core/src/test/java/org/springframework/integration/support/leader/LockRegistryLeaderInitiatorTests.java
* Stop initiators in the end of test
Fixed issues as per code review and added a test for terminating sub flow
Simplified implementation of enricher sub flow and simplified tests
Polishing
To avoid some extra methods and let to operate with more cleaner API, merge some specs to single entity
* Make `EnricherSpec` and `AbstractRouterSpec` as `extends ConsumerEndpointSpec`
* Remove extra methods in the `IntegrationFlowDefinition`
* Provide refactoring and fixed to `enrich()` and `route()` functions according the `ConsumerEndpointSpec` merge
* Port `TransformerTests` from SI-Java-DSL project
Also fix DSL messing `sendTimeout` property for routers.
Since other message handlers have this property on the `ConsumerEndpointSpec`, add support there
instead of `RouterSpec`, for consistency.
Also fix `ConsumerEndpointSpec` `sendTimeout` - can be applied to any
`AbstractMessageProducingHandler`, not just `AbstractReplyProducingMessageHandler`.
Ditto for `async`.
Polishing
JIRA: https://jira.spring.io/browse/INT-4100
* Add `throws MessagingException` to the `RequestReplyExchanger` to make it fully messaging contract based
* Add test to the `ServiceActivatorDefaultFrameworkMethodTests` to demonstrate how many info is in the stack trace after `RequestReplyExchanger`
* Document how to be with the `throws` clause in custom gateways
* Fix `boolean` attributes in the `spring-integration-5.0.xsd`
* Fix `AbstractChannelAdapterParser` do not populate endpoint attributes if component is nested
* Fix typo in the `AmqpOutboundChannelAdapterParserTests`
* Increase timeouts in the `MixedDispatcherConfigurationScenarioTests`
Reinstate `auto-startup` to none by default.
Not all components expects `true` by default in their initial state
Also https://jira.spring.io/browse/INT-3432
Document the behavior of the `throws` clause on gateway method
Remove unrelated `bridge` id from the `<chain>`
Add What's new about `RequestReplyExchanger` changes
Doc Polishing.
JIRA: https://jira.spring.io/browse/INT-4018
* Resolve some TODOs as expected
* Remove some as logically or physically with useless effort
* Leave others for future considerations
JIRA: https://jira.spring.io/browse/INT-4101
Document `PassThroughTransactionSynchronizationFactory`
Copyright year and author name added
Documentation improved
Polishing
JIRA: https://jira.spring.io/browse/INT-4219
- Use `AdditionalAnswers.returnFirstArgument` instead of lambda to return first arg
- Enable CheckStyle `AvoidStaticImport` for tests
- Fix static import violations in tests