JIRA: https://jira.spring.io/browse/INT-4038
General format for node name: bean.method#n
The #n is needed to disambiguate methods with the same name.
Polishing according PR comments
* Fix generic type for `Collections.unmodifiableMap` usage
* Change the gateway method logic in the `IntegrationGraphServer` to include the method signature in the node name to distinguish them as unique
* Move `MutableMessageBuilderFactoryTests` into the separate nested `mutable` package since `@IntegrationComponentScan` sees a new `@MessagingGateway` in the `IntegrationGraphServerTests`.
See https://jira.spring.io/browse/INT-4040
* Document the `@MessagingGateway` representation in the `graph.adoc`
The `RedisMessageGroupStoreTests.testMessageGroupUpdatedDateChangesWithEachAddedMessage()` can fail
sporadically because there is no guaranty the several calls to the `System.getCurrentTimeMillis()` return the same value.
* Fix `AbstractKeyValueMessageStore` to reuse `MessageGroup.timestamp` for the `lastModified` in case of a new group
https://build.spring.io/browse/INT-B43-199/
The `circuitBreakerTests()` relied on the enough short `Thread.sleep(100)`,
which may not be enough in the heavy-load environment like CI Server.
Therefor the time in between thread switching really can be much bigger than expected.
* Fix the test via timeout "emulation" using reflection to set the `lastFailure` somewhere in the past
to overcome `RequestHandlerCircuitBreakerAdvice.halfOpenAfter` barrier
JIRA: https://jira.spring.io/browse/INT-4021
Previously the `SimpleMessageStore` unconditionally followed with the super class options
and provided the `lazy-load` functionality by default.
* Since `persistent` and `lazy-load` logic does not make sense for the `in-memory` store, disable it in the `SimpleMessageStore`
* Fir `AggregatorTests` for better coverage.
* NOTE: The same message can't be persisted in the Persistent `MessageStore`. The store key is fully based on the `messageId`.
And also we provide the header which indicates that the messages has been stored before. See `JdbcMessageStore.addMessage()` for example:
```
if (message.getHeaders().containsKey(SAVED_KEY)) {
Message<T> saved = (Message<T>) getMessage(message.getHeaders().getId());
if (saved != null) {
if (saved.equals(message)) {
return message;
} // We need to save it under its own id
}
}
```
* Fix (S)FTP Streaming tests to use `AbstractPersistentAcceptOnceFileListFilter` instead of raw `AcceptOnceFileListFilter`,
which relies on the object identity, but neither `FtpFile`, nor `ChannelSftp.LsEntry` provides good `equals()` and `hashCode()` implementations.
* Make `StompIntegrationTests` as `DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD` because the sporadic failure on the Travis around wrong value from the queue isn't clear (yet).
Looks like some interim event is generated by the Websocket Container on the Tomcat.
JIRA: https://jira.spring.io/browse/INT-4020
The fix for `named` global `wire-tap`s (INT-2230) didn't covered testing for `unnamed`.
Therefore the fix unconditionally didn't picked up the issue that we used a wrong `BeanDefinition` to determine the current `id`
* Fix `WireTapParser` to use `wireTapBeanName` from the `resolveId()` when the `GlobalChannelInterceptorParser` invokes it.
* Add tests to demonstrate the issue and confirm the fix
**Cherry-pick to 4.2.x**
JIRA: https://jira.spring.io/browse/INT-4005
* The `<int:queue>` lets declare the `capacity` attribute together
with either `message-store` or `ref` attributes, which it is not
correct
* The `<int:queue>` lets declare the `capacity` attribute together
with either `message-store` or `ref` attributes, which it is not
correct
* The `priority-queue` lets declare the `capacity` attribute
together with the `message-store` attribute, which it is not
correct
* Reference documentation fixed for `channel.adoc` and `jdbc.adoc`,
doing mention about these restrictions
* Minor changes about conventions and formats applied.
Code polishing
JIRA: https://jira.spring.io/browse/INT-4015https://jira.spring.io/browse/INT-3854
Initial commit.
Reworked to emit an input stream and use the file splitter.
Add StreamTransformer.
Add CLOSABLE_RESOURCE header so we can close the session automatically.
Implement INT-3854, FTP, SFTP
(S)FTP Namespace Changes
Docs - also fixes a PDF overflow
Polishing - PR Comments
checkstyle fixes
Polishing - Add Namespace for StreamParser
Polishing - PR Comments
* Upgrade to SA and SF snapshots
* Address TODOs regarding those upgrades
* Resolve some other TODOs
* Replace `PropertyPlaceholderConfigurer` beans with the `<context:property-placeholder>`
* Upgrade to Spring Social Twitter 1.1.2 and resolve deprecations via mocks (https://github.com/spring-projects/spring-social-twitter/issues/91)
* Upgrade to Curator `3.1.0` and resolve deprecation in the `ZookeeperMetadataStore`
JIRA: https://jira.spring.io/browse/INT-3991
* Add `IntegrationGraphController` `@RestController` over `IntegrationGraphServer` bean
* Add `@EnableIntegrationGraphController` and `<int-http:graph-controller>` to register
`IntegrationGraphController` if the `DispatcherServlet` is in classpath.
* Also register the `IntegrationGraphServer` bean from the same place, if that isn't presented in the application context yet.
* Allow to configure the "root" `path` for the `IntegrationGraphController` as a placeholder value via
`spring.integration.graph.controller.request.mapping.path` property
* Add tests for both `@EnableIntegrationGraphController` and `<int-http:graph-controller>` cases based on the `MockMvc`
JIRA: https://jira.spring.io/browse/INT-3387,
https://jira.spring.io/browse/INT-3806
* Introduce
```
MessageGroupStore
void addMessagesToGroup(Object groupId, Message<?>... messages);
```
And implement it in all stores.
* Use new `addMessagesToGroup` where it is reasonable, e.g. `DelayHandler`
* Optimize test-case to use a new store method (where it is possible)
* Fix timing delays in the `JdbcMessageStoreTests`
* Introduce `PersistentMessageGroup`
* Add `AbstractMessageGroupStore#proxyMessageGroupForLazyLoad` to wrap the raw `MessageGroup` to the `PersistentMessageGroup` for lazy-load
* Rework `MessageGroupMetadata` do not be `immutable` and allow to store/restore in the `AbstractKeyValueMessageStore` only the `MessageGroupMetadata`
* Refactor `ResequencingMessageHandler` and `SequenceSizeReleaseStrategy` a bit for better performance when interact with the `MessageGroup`
* Add `AbstractMessageGroupStore#setLazyLoadMessageGroups` to switch off the `lazy-load` behavior and restore the previous full `MessageGroup` logic
* Add `What's New` note and `message-store.adoc` paragraph for the lazy-load functionality
`GroupType.PERSISTENT` and not lazy by default
PR Comments
Fix `JdbcMessageStoreTests` timing issues
Address PR comments
* Add performance test to the `ConfigurableMongoDbMessageGroupStoreTests`
* Add JavaDocs for the `MessageGroupFactory` methods
* Add `log4j.properties` into the `test` MongoDB module for better traceability
* Fix `JdbcMessageStore#getOneMessageFromGroup()` over the `doPollForMessage()` delegation.
The `jdbcTemplate.queryForObject()` requires exactly one and only one raw in `resultSet`
* Add performance test results into the `message-store.adoc`
JIRA: https://jira.spring.io/browse/INT-4001
Since all other Spring Framework components use the Jackson's `ObjectMapper` configuration by default as:
```
this.objectMapper.configure(MapperFeature.DEFAULT_VIEW_INCLUSION, false);
this.objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
```
It would be better to be consistent in Spring Integration, too.
* Add mention options to the `Jackson2JsonObjectMapper` default's `ObjectMapper`
* Add on more constructor into the `Jackson2JsonMessageParser` to allow to inject customized `Jackson2JsonObjectMapper`
* Modify a couple tests to reflect the change
* Reformat code style in the `AbstractJsonInboundMessageMapperTests` for better readability
**The Migration Guide note follows up**
JIRA: https://jira.spring.io/browse/INT-3999
Since the scheduled tasks may live for a long time it can finish
with the `OutOfMemory` if we use the direct reference to big objects, like `Message<?>`.
* Fix `AbstractCorrelatingMessageHandler` to deal only with the `groupId`
from the `scheduleGroupToForceComplete()` when we `schedule` `Runnable` for the `forceRelease` logic.
* Fix `DelayHandler` to deal only with `messageId` in the `releaseMessageAfterDelay()`, when we
`schedule` `Runnable` for the `releaseMessageAfterDelay`.
* Since the logic hasn't been changed for those components, there is no any new test.
There is just enough to be sure that all existing tests are fine.
**Cherry-pick to 4.0.x, 4.1.x, 4.2.x**
Optimise the release task for the `SimpleMessageStore` case
JIRA: https://jira.spring.io/browse/INT-3998
Do not modify interceptors from the `AbstractMessageChannel`.
They must be declared as beans, too.
Fix [UnusedImport] in the `EnableIntegrationTests`
Doc Polishing
JIRA: https://jira.spring.io/browse/INT-3980
When we declare our components via `@Bean` (or `<bean>`) the requirements for
the `@Component` (`@MessageEndpoint`) looks redundant and sometimes even dangerous,
when we use `@ComponentScan`, too.
* Remove the `@Component` restriction logic from the `MessagingAnnotationPostProcessor`
* Ensure that tests pass
(We may consider to backport afterwards)
Add `requireComponentAnnotation` logic
* Introduce `spring.integration.messagingAnnotations.require.componentAnnotation` property for `spring.integration.properties` as `false` by default
* Add `MessagingAnnotationPostProcessor#setRequireComponentAnnotation()` to accept the value from the `spring.integration.messagingAnnotations.require.componentAnnotation`
* Fix `integraton` typo everywhere
* Document the change in the `What's New` and in the `configuration.adoc`
* Ensure that logic works properly (no messaging endpoints populated) with the `spring.integration.messagingAnnotations.require.componentAnnotation = true` and "unannotated" `AnnotatedEndpoint2` in the `AnnotatedEndpointActivationTests`
This PR also fixes: https://jira.spring.io/browse/INT-3962
Fix issues according Travis report
Doc Polishing
JIRA: https://jira.spring.io/browse/INT-3979
Previously we had a to instantiate all messages from the `MessageBuilder`
if we would like to return messages as splitted items.
For example to populate some item-specific headers.
From other hand the `MessageBuilder` as an item incorrectly remained as a `payload`.
* Add condition logic to the `AbstractMessageSplitter` to properly handle `AbstractIntegrationMessageBuilder`
and don't create an extra `Message`
* Apply the same logic to the `AbstractAggregatingMessageGroupProcessor`
(We may consider to backport it later)
JIRA: https://jira.spring.io/browse/INT-3984
The `PropertySourcesPlaceholderConfigurer implements BeanFactoryPostProcessor, PriorityOrdered`
meaning that it is run before any other regular `BeanFactoryPostProcessor`,
like the `IntegrationConfigurationBeanFactoryPostProcessor` has been before.
With such an order any `BeanDefinition` declaration from the `IntegrationConfigurationBeanFactoryPostProcessor` process
ended up without `PP` resolutions.
* Rework `IntegrationConfigurationBeanFactoryPostProcessor` to the `BeanDefinitionRegistryPostProcessor`,
which makes it be loaded as early as possible. See `PostProcessorRegistrationDelegate`:
````java
// Now, invoke the postProcessBeanFactory callback of all processors handled so far.
invokeBeanFactoryPostProcessors(registryPostProcessors, beanFactory);
invokeBeanFactoryPostProcessors(regularPostProcessors, beanFactory);
````
* Modify `EnableIntegrationTests` and `ChannelSecurityInterceptorSecuredChannelAnnotationTests` to ensure that the change
meets the `PP` and `SpEL` resolutions during bean definition phase.
* Fix the timing issue in the `JdbcMessageStoreChannelIntegrationTests`
JIRA: https://jira.spring.io/browse/INT-3978
Previously the `MessageHistory.write()` always used `MessageBuilder` to populated the `history` header.
Since the `MessageBuilder` doesn't care about the `source` message type, we might lose some important information,
like `AdviceMessage.inputMessage`
* Add conditional logic into the `MessageHistory` for all known `Message<?>` implementations
* Provide appropriate tests in the `MessageHistoryTests` for known `Message<?>` implementations
* Make `AdviceMessage` generic and fix all affected code on the matter
* Since `MutableMessage` is public already, fix `MongoDbMessageStore.DBObjectToMutableMessageConverter` to use
`MutableMessage` type directly.
Add WARN for non-standard `Message` type
Fixes https://build.spring.io/browse/INT-MJATS41-593
* Fix `LoggingHandler` JavaDoc
* Fix `JdbcOutboundGatewayParserTests` timing and race condition issues
* Add `mock(BeanFactory.class)` to the `JpaOutboundChannelAdapterTests` for `JpaExecutor`
* Fix `JpaOutboundChannelAdapterTests` for the incorrect transaction usage
JIRA: https://jira.spring.io/browse/INT-3981
Since the `MessageHandlerChain` uses a `ReplyForwardingMessageChannel` in the end of invocation,
we don't need to have add an extra `<bridge>` for shifting just populated `replyChannel` header.
* Add a couple tests to prove that
* Fix the typos in the `ChainParserTests`
* Remove unnecessary `DirectFieldAccessor` usage in the `MessageHandlerChain`
checkstyle EmptyBlock
checkstyle fixRightCurly Script
checkstyle EmptyStatement
checkstyle RightCurly
checkstyle TailingWhite
checkstyle NeedBraces
Fix the line separator in the `fixRightCurly.gradle`
JIRA: https://jira.spring.io/browse/INT-3977
* Add `Level` ctor
* Add `setLogExpression(Expression)` and `setLogExpressionString(String)`
* Deprecate existing `setExpression(String)` in favor of those new
* Some refactor for redundant code around `evaluationContext`
* Fix tests according a new `LoggingHandler` logic
* Add JavaConfig sample to the Reference Manual
fixes
fixModifiers after fixFinal
Revert CachingSessionFactory
Class is spied in tests.
checkstyle - Import Rules
checkstyle InterfaceIsType
checkstyle InnerTypeLast
checkstyle OneStatementPerLine
CovariantEquals
OneTopLevelClass
* Revert `'\n'` -> `System.lineSeparator()` in the Gradle scripts to meet Git `autocrlf = true` on Windows
* Fix timing issue with the `LastModifiedFileListFilterTests`, when the `age = 1` might not be enough for the file object when we have some delay before checking
JIRA: https://jira.spring.io/browse/INT-3944
Polishing (PR comments) and Doc Polish
Polishing - PR Comments
Remove custom `async` boolean in favor of the now public setter.
Add exception to `JmsException` hierarchy.
INT-3944: Polishing
* Rename `asyncReplySupported` just to `async`. As well as its getter and setter. Plus fix docs on the matter
* Polishing for the `JmsOutboundGateway` according PR comments
* Rework `JmsOutboundGateway` to return `AbstractIntegrationMessageBuilder` instead of `Message`
since `AbstractMessageProducingHandler` rebuilds `Message` for a new one to copy headers from request
* Add `getPayload()` and `getHeaders()` to the `AbstractIntegrationMessageBuilder` to make the `Routing Slip`
users happy, when the `AbstractIntegrationMessageBuilder` is pushed to the `Routing Slip path` function
* Fix race condition in the `ChatMessageListeningEndpointTests`: the `stanza` parsing is done in the different Thread.
Doc Polishing (Routing Slip)
Fix timing issue in the `LastModifiedFileListFilterTests`:
`Thread.sleep()` not always reflects the reality.
Switch to the "past simulation" via explicit `File.setLastModified()`
JIRA: https://jira.spring.io/browse/INT-3959
Also add `LifecycleMessageHandlerMetrics.getDelegate()` and `LifecycleMessageSourceMetrics.getDelegate()`
to avoid reflection on each `extractManagedBean()`
* `gradlew clean check -x test --parallel --continue` - to collect reports
* `gradlew fixThis --parallel` - to fix all possible vulnerabilities. With `-Dfile.encoding=UTF-8` on Windows
Since the `RequireThisCheck` doesn't see parents for anonymous classes (e.g. `Runnable` callback), its report doesn't contains the outer class name with `this.`,
therefore we still have to fix those cases manually.
Thanks to the wrong `replacer` just with `this.` we have uncompilable code enough easy to find problems.
Not so easy to fix for good readability though...
* Upgrade to Grade 2.12
* Upgrade to SonarQube native plugin
The fix contains at about 300 files. So, will be done on merge.
Fix `fixThis.gradle` according PR comments
Apply `fixThis` and also `fixModifiers` for test classes.
Fix some `this.` inner issues manually.
Make code polishing for long lines after `fixThis`
Fix conflicts and vulnerabilities after the rebase
Add `fixModifiers.gradle` to run after `check` task.
The `RedundantModifierChecker` doesn't catch all errors at once.
We need run `check -> fixModifiers` pair several times to reach `SUCCESSFUL`.
The `fixThis` has been ported from the SA, but without applying.
* Polishing for `fixModifiers.gradle`
* Fix all redundant modifier with the `fixModifiers.gradle`
NOTE: Since all these task modify files on Windows we have to run them with the `-Dfile.encoding=UTF-8`.
Otherwise they are read and write with the Windows default `cp1251` making them incompatible with Unix system.
JIRA: https://jira.spring.io/browse/INT-3961
The `@InboundChannelAdapter` may be initialized by its `MessagingAnnotationPostProcessor` a bit earlier than the
provided channel is created and registered in the context - via some other more late `BPP`, e.g. `IntegrationFlowBeanPostProcessor` from Java DSL.
* Add channel late-binding logic to the `InboundChannelAdapterAnnotationPostProcessor` and `SourcePollingChannelAdapter` by the provided `outputChannelName` option.
* Add the `channel` alias for the `value` annotation attribute in the `@InboundChannelAdapter`
* Add the `@InboundChannelAdapter` configuration into the `EnableIntegrationTests` without the channel declaration to be sure that the fix provide the expected results without `DestinationResolutionException`
* Mention both changes in the `configuration.adoc` and `whats-new.adoc`
JIRA: https://jira.spring.io/browse/INT-3956
Use reflection in tests to access private members
fix assertion imports
Polishing author rights.
Make tests `Threas.sleep()` free.
JIRA: https://jira.spring.io/browse/INT-3947
Async Message Handler
If `asyncReplySupported` and the handler returns a `ListenableFuture<?>`,
defer the send to the reply channel until the future is satisfied.
First candidate would be the `AmqpOutboundGateway` wired with an
`AsyncRabbitTemplate`.
Polishing - Use errorChannel Header for Exceptions
Add more tests.
Polishing - ListenableFuture Callback Exceptions
Polishing - send error if error on async output
Cover `onFailure()` from `onSuccess()` with the `errorChannel`