9679 Commits

Author SHA1 Message Date
Spring Buildmaster
e26243609f [artifactory-release] Next development version 2020-10-28 14:57:13 +00:00
Spring Buildmaster
4f3cbc2e9f [artifactory-release] Release version 5.1.13.RELEASE 2020-10-28 14:57:08 +00:00
Artem Bilan
0d48eaf788 Upgrade dependencies; prepare for release 2020-10-28 10:33:09 -04:00
Artem Bilan
90183cc5bd Remove channelMessages collection before tests
The `MongoDbAvailableTests.cleanupCollections()` remove some collections
before tests, but not `channelMessages`

* Fix the `ConfigurableMongoDbMessageGroupStoreTests` to remove `channelMessages`
collection, too
2020-10-22 13:17:57 -04:00
Artem Bilan
b2d7867ce2 Fix @InChAdapter for several supplier beans
The `InboundChannelAdapterAnnotationPostProcessor` doesn't use a bean method name
when it parses a `Supplier` bean and only uses a configuration class name + `get`
for method part

* Fix `InboundChannelAdapterAnnotationPostProcessor` to also include a bean method
name into the final bean name for the `MethodInvokingMessageSource` based on
the `Supplier` bean
* Modify `ReactiveInboundChannelAdapterTests` to add one more `Supplier` with the
`@InboundChannelAdapter` to ensure that configuration is still valid after the fix

**Cherry-pick to 5.2.x & 5.1.x**
2020-10-22 12:43:18 -04:00
Gary Russell
c74cd1fedc Fix QueueChannel.destroy() (previous commit) 2020-07-28 17:16:48 -04:00
Artem Bilan
585da69164 Add gauges for queue channel size (#3349)
* Add gauges for queue channel size

The `QueueChannel` provides a current size and remaining capacity metrics

* Add Micrometer gauges into `QueueChannel` to expose the current values
of the size and remaining capacity

**Cherry-pick to 5.3.x, 5.2.x & 5.1.x**

* * Revert `@SuppressWarnings("unchecked")` for test
* Document new gauges for queue channel

* * Fix IntegrationManagementConfigurer for NPE on `metricsCaptor`

* Fix wording in meter descriptions

Co-authored-by: Michel Jung <michel.jung89@gmail.com>

Co-authored-by: Michel Jung <michel.jung89@gmail.com>
2020-07-28 17:06:50 -04:00
Spring Buildmaster
54999bf036 [artifactory-release] Next development version 2020-07-22 18:15:38 +00:00
Spring Buildmaster
004527971b [artifactory-release] Release version 5.1.12.RELEASE 2020-07-22 18:15:33 +00:00
Artem Bilan
5bbf9dd868 Improve MessageKryoRegistrar for registrations
(cherry picked from commit 5ec71d4b4a)

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/codec/kryo/CompositeKryoRegistrar.java
2020-07-22 13:39:01 -04:00
Artem Bilan
7b680ef268 Upgrade dependencies; prepare for release 2020-07-22 12:37:51 -04:00
Artem Bilan
50f196d654 Fix typo in KryoCodecTests
(cherry picked from commit 5e45b09cd5)
2020-07-22 12:34:26 -04:00
Artem Bilan
fcb8cafd1e Improve Kryo Codec for registrations
# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/codec/kryo/KryoCodecTests.java
2020-07-22 12:09:24 -04:00
Artem Bilan
35ea2688cb GH-3348: Upgrade to MQTT Paho-1.2.4
Fixed https://github.com/spring-projects/spring-integration/issues/3348

**Cherry-pick to 5.3.x, 5.2.x & 5.1.x**

# Conflicts:
#	build.gradle
2020-07-21 10:20:57 -04:00
Gary Russell
8df8028537 Fix CachedSessionFactory Race
Close the pool so that any sessions returned after the factory is
`destroy()`ed are closed.

* Call `removeAllIdleItems()` in `close()`.

* Close sessions in `SftpStreamingMessageSourceTests`.

**cherry-pick to all supported branches**
# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/util/SimplePoolTests.java
2020-07-08 14:31:35 -04:00
Spring Buildmaster
fe524dd1e6 [artifactory-release] Next development version 2020-06-10 14:35:32 +00:00
Spring Buildmaster
cbfcb939cd [artifactory-release] Release version 5.1.11.RELEASE 2020-06-10 14:35:26 +00:00
artembilan
f51343ff51 Upgrade dependencies; prepare for release 2020-06-10 10:09:40 -04:00
artembilan
dc3ae26c81 Code clean up for JacksonJsonUtils
* Mention `trustedPackages` in the `redis.adoc`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
2020-06-09 14:53:16 -04:00
astrubel
7b40488533 GH-3294: Retry JdbcLock.unlock for TransDataAccEx
Fixes https://github.com/spring-projects/spring-integration/issues/3294

A `DeadlockLoserDataAccessException` occurs at `JdbcLockRegistry$JdbcLock.unlock()` - 
better to retry like in the `lock()`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
2020-06-09 13:31:29 -04:00
Vladimir Plizga
05ceee3c88 GH-3286: Make FileTailingEvent#getMessage public
Fixes https://github.com/spring-projects/spring-integration/issues/3286

The `FileTailingEvent.getMessage()` is really meant to be as `public`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
2020-05-21 09:51:45 -04:00
Artem Bilan
5ef737a96b GH-3276: reactive inbound: Fix onErrorResume
Fixes https://github.com/spring-projects/spring-integration/issues/3276

The `onErrorResume` for the `MessagingGatewaySupport.doSendAndReceiveMessageReactive()`
was in wrong place: only for the `buildReplyMono` which works only
when an outbound flow is fully based on reactive channels.
With a regular direct channel we can get an exception from the
`sendMessageForReactiveFlow` which is not covered with the mentioned
`onErrorResume` for the error handling on the configured `errorChannel`

Cherry-pick to `5.2.x & 5.1.x`

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/gateway/MessagingGatewaySupport.java
2020-05-13 15:36:05 -04:00
Artem Bilan
f759f0bacc Fix SftpStreamingMessageSourceTests for race
It turns out there is some race condition between tests
against the same source dir.

* Add `DirtiesContext.ClassMode.AFTER_EACH_TEST_METHOD` to clean
up the application context state after each test method
2020-05-12 11:30:45 -04:00
Artem Bilan
65b3bdc39d GH-3271: Close session on error in stream source
Fixes https://github.com/spring-projects/spring-integration/issues/3271

When exception happens at `.withPayload(session.readRaw(remotePath))`
in the `AbstractRemoteFileStreamingMessageSource` we don't close session.
The resource leaking happens in the caching session factory

* Add `session.close();` into the `catch (IOException e) {`
in the `AbstractRemoteFileStreamingMessageSource.doReceive()`
to clean up resources properly

**Cherry-pick to 5.2.x, 5.1.x & 4.3.x**
2020-05-11 16:52:09 -04:00
Gary Russell
c931c2b3ed BoundRabbitChannelAdvice - reject invalid config
Don't allow a `waitForConfirmsTimeout` if the factory is not configured
for simple publisher confirmations.

Otherwise, a runtime error will occur.

**cherry-pick to 5.2.x, 5.1.x**

(cherry picked from commit 3e63fe4eb7)
2020-04-29 15:14:07 -04:00
Spring Buildmaster
97ff7ba897 [artifactory-release] Next development version 2020-04-29 13:15:15 +00:00
Spring Buildmaster
ec00eb91e0 [artifactory-release] Release version 5.1.10.RELEASE 2020-04-29 13:15:10 +00:00
Artem Bilan
a3daffc4b7 Fix MongoDB tests compatibility with Spring Data 2020-04-28 14:58:04 -04:00
Artem Bilan
860f595080 Upgrade dependencies
* Remove unnecessary Mockito stubbing from the `FileReadingMessageSourceTests`
2020-04-28 14:23:25 -04:00
Artem Bilan
a28f5b68a5 GH-3253: Scan BF hierarchy for BeanDefinition
Fixes https://github.com/spring-projects/spring-integration/issues/3253

The `IntegrationFlowBeanPostProcessor` uses a `containsBean()`
and then `getBeanDefinition()` to be sure that we don't override already
existing bean even if it is created in the parent(s) context.
The problem that `containsBean()` check the hierarchy, but `getBeanDefinition()`
doesn't.
So, we fail with `NoSuchBeanDefinitionException` if bean exists in the parent ctx

* Introduce an utility `IntegrationContextUtils.getBeanDefinition()` to
scan `BeanFactory` recursively for `BeanDefinition` for the requested `name`
* Use this tool in the `IntegrationFlowBeanPostProcessor` logic

**Cherry-pick to 5.2.x & 5.1.x**
2020-04-24 14:10:12 -04:00
Artem Bilan
8075e157a3 GH-3249: Fix RemoteFileTemplate dead lock in send
Fixes: https://github.com/spring-projects/spring-integration/issues/3249

When the `CachingSessionFactory` is configured with small enough pool
and it is very likely that dead lock may happen when `RemoteFileTemplate.send()`
is used.
The problem happens when we reach the `RemoteFileTemplate.exists()` call
which is done from the internal method called from already pulled from cache
`Session`

* Fix `RemoteFileTemplate` to use a `session.exists()` instead on the provided
into the method `Session`
* Demonstrate the problem in the `SftpRemoteFileTemplateTests.testNoDeadLockOnSend()`

**Cherry-pick to 5.2.x, 5.1.x & 4.3.x**

Fix RemoteFileOutboundGWTests for the proper mock
2020-04-20 11:29:31 -04:00
Artem Bilan
78becd5391 GH-3247: Fix SftpSession.exists for error code (#3248)
* GH-3247: Fix `SftpSession.exists` for error code

Fixes https://github.com/spring-projects/spring-integration/issues/3247

When there is no path on the SFTP server, a `ChannelSftp.SSH_FX_NO_SUCH_FILE`
error is returned in the thrown `SftpException`.

* Fix `SftpSession.exists()` to check for the `SSH_FX_NO_SUCH_FILE` to
return `false` and re-throw an exception otherwise
* Add mock test for `SftpSession.exists()`
* Add `org.mockito.AdditionalMatchers` to `checkstyle.xml` exclusions

**Cherry-pick to 5.2.x & 5.1.x**

* * Add exists tests against Mina embedded server
2020-04-14 15:43:36 -04:00
Artem Bilan
2d00bfc301 GH-3238: Fix Unmarshaller to close File resource
Fixes https://github.com/spring-projects/spring-integration/issues/3238

* Extract an `InputStream` from a `File` payload in the `UnmarshallingTransformer`
before parsing an XML.
Close this `InputStream` in the `finally` block to release the file resource

**Cherry-pick to 5.2.x, 5.1.x & 4.3.x**

# Conflicts:
#	spring-integration-xml/src/main/java/org/springframework/integration/xml/transformer/UnmarshallingTransformer.java
#	spring-integration-xml/src/test/java/org/springframework/integration/xml/transformer/jaxbmarshaling/JaxbMarshallingIntegrationTests.java
2020-04-02 21:40:05 -04:00
Gary Russell
1f463a194d GH-3199: Fix fail back with Long.MAX_VALUE
Resolves https://github.com/spring-projects/spring-integration/issues/3199

When the `refreshSharedInterval` was `Long.MAX_VALUE` the test for whether
the interval was exceeded always returned true.

Use a boolean instead (already in place on master).

I will backport to 5.1.x, 4.3.x after merge.
2020-03-05 11:25:22 -05:00
Gary Russell
d8db1122c4 GH-3199: Fix typo; move capture of creation time 2020-02-28 16:38:07 -05:00
Gary Russell
dc266fae78 GH-3199: FailoverClientCF - Fail Back Option
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
2020-02-28 16:16:38 -05:00
Gary Russell
a8bb444955 disconnectCompletionTimeout Polishing
- rename from `stopCompletionTimeout`
- add to outbound adapter
- use in both places we disconnect on inbound

**cherry-pick forward to 5.2.x, master**
2020-02-27 17:27:49 -05:00
Gary Russell
4174bfd6ca Upgrade to MQTT Paho 1.2.2
- 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
2020-02-27 16:56:37 -05:00
Jayadev Sirimamilla
35fd383399 GH-3152: Fix for nested Scatter Gather
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**

# Conflicts:
#	spring-integration-core/src/test/java/org/springframework/integration/dsl/routers/RouterTests.java
2020-01-27 15:09:03 -05:00
Gary Russell
1565c2ac7b Fix TcpConnectionFactory FactoryBean
- bean factory and application context were not injected
- `afterPropertiesSet()` was not called

**cherry-pick to all supported branches**

# Conflicts:
#	spring-integration-ip/src/main/java/org/springframework/integration/ip/config/TcpConnectionFactoryFactoryBean.java
2019-11-20 15:06:21 -05:00
Spring Buildmaster
c034db238c [artifactory-release] Next development version 2019-11-04 21:20:04 +00:00
Spring Buildmaster
5966269d66 [artifactory-release] Release version 5.1.9.RELEASE 2019-11-04 21:20:00 +00:00
Gary Russell
c38f1c5681 Upgrade Spring Security 2019-11-04 15:41:16 -05:00
Artem Bilan
5c6f65f218 GH-3061: Add @DirtiesContext to JPA tests
Fixes https://github.com/spring-projects/spring-integration/issues/3061

Without a `@DirtiesContext` we keep not only a ctx in the cache, but
also an embedded DB instance, which is shared between contexts.
When ctx cache clean up happens, several ctxes would like to destroy
their associated embedded DB which, essentially, is the same in-memory
instance

* The `@DirtiesContext` give us a chance to destroy embedded DB for
the particular ctx in isolation
2019-11-04 14:06:50 -05:00
Gary Russell
9199deb742 Upgrade dependencies 2019-11-04 12:10:28 -05:00
Artem Bilan
ab641909ff Fix StompMHWebSocketIntTests for reconnect events
https://build.spring.io/browse/INT-MASTERSPRING40-740
2019-11-04 11:57:55 -05:00
Artem Bilan
b7ee269cc9 Use EmitterProcessor for Channels adaptation (#3100)
* Use `EmitterProcessor` for Channels adaptation

Related https://github.com/spring-cloud/spring-cloud-stream/issues/1835

To honor a back-pressure after `MessageChannel` adaptation it is better
to use an `EmitterProcessor.create(1)` instead of `Flux.create()`.
This way whenever an emitter buffer is full, we block upstream producer
and don't allow it to produce more messages

**Cherry-pick to 5.1.x**

* * Wrap every new subscription into a `Flux.defer()`
* Fix `ReactiveStreamsConsumerTests` to use a new `Subscription` after
each `stop()/start()` on the `ReactiveStreamsConsumer`

* * Remove unused imports

# Conflicts:
#	spring-integration-core/src/main/java/org/springframework/integration/endpoint/ReactiveStreamsConsumer.java
#	spring-integration-core/src/test/java/org/springframework/integration/channel/MessageChannelReactiveUtilsTests.java
#	spring-integration-core/src/test/java/org/springframework/integration/channel/reactive/ReactiveStreamsConsumerTests.java

* Fixing conflicts in tests
2019-11-01 16:19:06 -04:00
Artem Bilan
54de7a2209 GH-3089: Add AmqpInGateway.replyHeadersMappedLast (#3091)
* GH-3089: Add AmqpInGateway.replyHeadersMappedLast

Fixes https://github.com/spring-projects/spring-integration/issues/3089

In some use-case we would like to control when headers from SI message
should be populated into an AMQP message.
One of the use-case is like a `SimpleMessageConverter` and its `plain/text`
for the String reply, meanwhile we know that this content is an
`application/json`.
So, with a new `replyHeadersMappedLast` we can override the mentioned
`content-type` header, populated by the `MessageConverter` with an
actual value from the message headers populated in the flow upstream

* Introduce an `AmqpInboundGateway.replyHeadersMappedLast`; expose it
on the DSL and XML level
* Use newly introduced `MappingUtils.mapReplyMessage()`
* Optimize `DefaultAmqpHeaderMapper` to not parse JSON headers at all
when `JsonHeaders.TYPE_ID` is already present (e.g. `MessageConverter`
result)
* Also skip `JsonHeaders` when we `populateUserDefinedHeader()`

**Cherry-pick to 5.1.x**

* * Fix language and package typos
* Add missed `@param` in JavaDoc of the `AmqpBaseInboundGatewaySpec.batchingStrategy()`
* Extract a `RabbitTemplate` `MessageConverter` to use for reply messages
conversion - pursue a backward compatibility
2019-10-31 16:46:07 -04:00
Artem Bilan
315fafdaf2 GH-3090: Add logout() to FtpSession.close()`
Fixes https://github.com/spring-projects/spring-integration/issues/3090

Without `logout()` the FTP session is not closed at all,
but just the connection is closed.
Some FTP servers close those sessions eventually anyway, but some just
leak with resources.

**Cherry-pick to 5.1.x & 4.3.x**
2019-10-30 15:42:10 -04:00
Joaquin Santana
35b964cc79 GH-3026: Fix chmod support for DSL
Fixes https://github.com/spring-projects/spring-integration/issues/3026

**Cherry-pick to `5.1.x`**

* Populate proper `FileTransferringMessageHandler` impl from DSL spec
implementations.
This way we are able to use a provided `chmod` from Java DSL
* Added `FileTransferringMessageHandlerSpec` ctor TODO
* Update SftpTests
* Code cleanup; `@Ignore` `SftpTests.testSftpOutboundFlowWithChmod()`
since it doesn't work properly on Windows

# Conflicts:
#	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/dsl/SftpTests.java
#	spring-integration-sftp/src/test/java/org/springframework/integration/sftp/inbound/SftpInboundRemoteFileSystemSynchronizerTests.java
2019-10-29 15:29:30 -04:00