JIRA: https://jira.spring.io/browse/INT-3730
Expose the `SSLSession` on `TcpConnection` to support custom header
mapping of properties from the session.
JIRA: https://jira.spring.io/browse/INT-3728
The `CachingClientConnectionFactory` uses a temporary (rejecting) listener until
the connection is established and then replaces the listener in the connection.
There is a race condition in that if the server starts sending messages before the
listener is replaced, the message is rejected.
Add a mechanism to delay `onMessage` calls until the real listener has been
registered.
Also fix `onMessage` in the cached connection so an `ErrorMessage` is propagated correctly.
To reproduce: revert src/main; add `Thread.sleep(1000)` before `registerListener(tcpListener);`
in `CachedConnection` ctor and run the new test.
To introduce a similar timing hole with the new code, add the sleep before
`this.theConnection.registerListener(this);` in `TcpConnectionInterceptorSupport`.
Summary of changes:
`CachingClientConnectionFactory`
- register the underlying connection's listener in the ctor, utilizing the
`TcpConnectionInterceptorSupport.registerListener()` method.
- fix `ErrorMessage` propagation.
`AbstractClientConnectionFactory`
- propagate the `enableManualListenerRegistration` to connections.
`TcpConnectionSuport`
- implement delay when manual listener registration is enabled.
Add test case.
Fix Failover Tests
`FailoverClientConnectionFactory`
- propagate enable manual listener registration to underlying factories
Polishing
Instead of waiting for a hard 1 second, intelligently wait
until the container is subscribed by sending/receiving a test message.
Also reduces the test run time from 20s to 200ms locally.
JIRA: https://jira.spring.io/browse/INT-3723
Since `RequestMappingHandlerMapping` has reverted to `@RequestMapping` parsing,
restore the previous logic with `@RequestMapping` generation in the `IntegrationRequestMappingHandlerMapping`
Use `AnnotationUtils.synthesizeAnnotation` instead of direct annotation creation through the inline impl
JIRA: https://jira.spring.io/browse/INT-3722
While the initial fix solved the reported problem, it caused a memory leak when
the gateway completed its work before the reader thread "closed" the connection,
releasing it to the pool. This left the connection in the deferred close state.
Handle the condition where the gateway signals it has completed its work
before the connection is released to the pool.
JIRA: https://jira.spring.io/browse/INT-3722
The TCP outbound gateway correlates replies based on the connection id.
When a `CachingClientConnectionFactory` is being used, the connection is
returned to the pool too early, and can be reused. It is possible that
the current thread then removes the "next" pending reply from the correlation map.
Add code to the `CachingClientConnectionFactory` so that the "self" close from the
connection (called after `onMessage`) is deferred and the actual close (return to cache)
is controlled by the gateway itself.
This mechanism will no longer be needed when INT-3654 is resolved (removal of the "self"
closing by connections). At that time, connection users (such as the gateway) will be
in complete control.
JIRA: https://jira.spring.io/browse/INT-3685
* Add `StompInboundChannelAdapter` to subscribe to STOMP destination and receive messages from them.
Destinations can be added/removed (hence subscribed/unsubscribed) at runtime.
* Add `stompMessageHandler` to the send messages to STOMP destinations.
* `destination` can be extracted from `MessageHeaders`, the `destination` and `destinationExpression` are also supported.
* `RECEIPT` Frame is also supported and emitted as `StompReceiptEvent`
* `StompExceptionEvent` is emitted when we have a `failure` for `CONNECT` Frame or as a reaction to the `ERROR` Frame.
* Introduce `StompSessionManager` abstraction to manage the single `StompSession` and allow to share it between different adapters.
* Add `WebSocketStompSessionManager` implementation over `WebSocketStompClient`
* Add `Reactor2TcpStompSessionManager` implementation for target Broker connections
* Add `StompHeaderMapper`
Address PR comments and JavaDocs
Polishing according PR comments
Polishing
JIRA: https://jira.spring.io/browse/INT-3718
* If not set to `false` explicitly, add `IgnoreHiddenFileListFilter` as a default in `FileListFilterFactoryBean`
* Update XML Schema XSD and add `ignore-hidden` attribute
* Update + Add tests
* Add documentation
* Add default `IgnoreHiddenFileListFilter` also to `DefaultDirectoryScanner`
JIRA: https://jira.spring.io/browse/INT-3719
YourKit profiling for a lightweight XD stream indicates a large
amount of time in `AMC.send()`.
- Only call `logger.isDebugEnabled()` once
- Eliminate the need to create an `UnmodifiableList` and calling `size()` to get the size of the interceptor list.
Polishing
INT-3719: Fix (PR Comment)
JIRA: https://jira.spring.io/browse/INT-3687
* Change `master` to use IO 2.0 BOM for versions
* Upgrade `jsonPath` to `2.0.0`
* Fix `IntegrationRequestMappingHandlerMapping` according the latest MVC changes around CORS:
https://jira.spring.io/browse/SPR-12933.
* No yet any tests for `Global CORS`: waiting for Namespace support in MVC
Test this with:
```
./gradlew clean springIoCheck -PplatformVersion=2.0.0.BUILD-SNAPSHOT -PJDK8_HOME=<jdk8-home>
```
JIRA: https://jira.spring.io/browse/INT-3677
Previously, you could not use a property placeholder or SpEL when
defining the `container-class` attribute on message-driven endpoints.
Register the container with bean name `adapterId.container`.
Also add an alias for the container message listener `adapterId.listener`.
Add tests for JMS-backed channels - no code changes needed because a factory bean is used.
JIRA: https://jira.spring.io/browse/INT-3706
Previously, the `mode` attribute on the (S)FTP outbound gateways was ignored.
Take account of the mode on (M)GET and (M)PUT commands.
JIRA: https://jira.spring.io/browse/INT-3705
* Add validation for annotation attributes which must be populated directly on the `MessageHandler` `@Bean` using setters
* Add `sendTimeout()` annotation attribute for all Messaging Annotations
* Remove `DEFAULT_SEND_TIMEOUT = 1000L` from `AbstractCorrelatingMessageHandler` to make its component consistent with all other
`AbstractMessageProducingHandler` implementation.
* Fix XSD docs and Reference Manual to say that default `send-timeout` for `AbstractMessageProducingHandler` components is `-1`, not `one second`
* Make all Messaging Annotations attributes as `String` to allow to configure through the Property Placeholder options
* Fix a couple of typos
Polishing
JIRA: https://jira.spring.io/browse/INT-3704
Some NoSQLs (e.g. Hazelcast) provide a distributed implementations for the `ConcurrentMap`,
so add `SimpleMetadataStore(ConcurrentMap<String, String> metadata)` to allow ot inject any `ConcurrentMap` implementation.
Demonstrate the support for Hazelcast in the `IdempotentReceiverIntegrationTests`
**Cherry-pick to 4.1.x**
JIRA: https://jira.spring.io/browse/INT-3700
Change to calculate proper syndicate entry date for comparison when
adding feeds for processing.
I have signed and agree to the terms of the SpringSource Individual
Contributor License Agreement.
unit test for recent changes to FeedEntryMessageSourceTests to verify
proper last seen date calculation.
updates for comments from code review
* newline at EOF on atom.xml
* removed question from code
* fetch files via classpath instead of file system
* 'else' on newline
* authorship on class
Polishing
JIRA: https://jira.spring.io/browse/INT-3698
The `HttpRequestExecutingMessageHandler` added two internal `Converters` to the `ConversionService` before.
In case of parent-child environment it causes memory leak: closing of child context doesn't release
`HttpRequestExecutingMessageHandler` instances, because those internal `Converters` aren't `static`, hence bounded to outer instance.
Actually after introduction since `4.0` version to the `HttpRequestExecutingMessageHandler` the code like:
```
Assert.isTrue(expectedResponseType instanceof Class<?>
|| expectedResponseType instanceof String
|| expectedResponseType instanceof ParameterizedTypeReference,
"'expectedResponseType' can be an instance of 'Class<?>', 'String' or 'ParameterizedTypeReference<?>'.");
if (expectedResponseType instanceof String && StringUtils.hasText((String) expectedResponseType)){
expectedResponseType = ClassUtils.forName((String) expectedResponseType, ClassUtils.getDefaultClassLoader());
}
```
These converters are redundant.
In addition remove the `expected type` for the `uriVariablesExpression` evaluation to avoid `MapToMapConverter`.
**Cherry-pick to 4.1.x, 4.0.x**
INT-3698: Provide robust logic for the `uriExpression` and `httpMethodExpression`
Make some polishing around `Assert`s, when `IllegalStateException` must be presented instead of `IllegalArgumentException`
for the expression evaluation results.
Polishing
JIRA: https://jira.spring.io/browse/INT-3663
Previously the `ChannelSecurityInterceptorBeanPostProcessor` was populated with direct `BeanDefinition`s for `ChannelSecurityInterceptor`s.
It caused an `early access to BeanFactory`.
The issue has been introduced by the `ChannelSecurityInterceptorFactoryBean`
* Rework `SecurityIntegrationConfigurationInitializer` do not populate `BeanDefinition`s to the `ChannelSecurityInterceptorBeanPostProcessor`, but just `bean names`
* Redesign `ChannelSecurityInterceptorBeanPostProcessor` to the `AbstractAutoProxyCreator`
* Introduce `SecuredChannel` annotation to be used on the `@Bean` level for `MessageChannel` definition
* Move `access policy` mapping to the `SecuredChannel` annotation
Address PR comments
Document `@SecuredChannel` annotation
JIRA: https://jira.spring.io/browse/INT-3701
Allow Spring Boot to determine type created by GatewayProxyFactoryBean
Spring Boot's @ConditionalOnBean can be used to activate some
configuration when a bean of a particular type is present in the
application context. To avoid early initialization, the search for
beans is performed without instantiating them, i.e. it relies on the
information that's available from the bean's class and its bean
definition. This causes a problem with GatewayProxyFactoryBean as its
a FactoryBean<Object> so Boot's best guess is that the bean that's
produced by the factory will be an Object. For cases where the bean's
type signiture does not contain enougn information to determine its
type, Boot looks at an attribute, factoryBeanObjectType, on the
factory bean's definition. The value of this attribute can be a Class
or a String class name.
This commit updates MessagingGatewayRegistrar to set the
value of factoryBeanObjectType attribute to be the configured
service interface for the gateway.
JIRA: https://jira.spring.io/browse/INT-3697
Since Spring Integration 4.0 the `MessageHeaders` had been moved to the Spring Messaging module
and `MessageHeaders.CONTENT_TYPE` had been changed from `content-type` name to the `contentType`.
Previously the automatic mapping of `contentType` to the HTTP Request `Content-Type` has been introduced
for the `HttpRequestExecutingMessageHandler`.
This fix do the same for the HTTP Response in case of HTTP Inbound Endpoint.
This allows to transfer HTTP headers automatically from underlying HTTP Outbound Endpoint for HTTP Proxy scenario.
The response from that external HTTP service maybe changed during a downstream flow before sending HTTP Response from the HTTP Inbound Endpoint.
Before this we was forced to map `contentType` to `Content-Type` manually or just rely on the `HttpMessageConverter`s.
**Cherry-pick to 4.1.x**