Commit Graph

10269 Commits

Author SHA1 Message Date
Spring Builds
7ff3b5de02 [artifactory-release] Next development version 2022-01-18 16:46:53 +00:00
Spring Builds
8b2138c493 [artifactory-release] Release version 5.3.10.RELEASE 2022-01-18 16:46:50 +00:00
Artem Bilan
bccb1d5728 Upgrade dependencies; prepare for release 2022-01-18 11:04:46 -05:00
shvo123
983ea4f624 GH-3705: Close TcpNioConn.ChannelOutStr.selector
Fixes https://github.com/spring-projects/spring-integration/issues/3705

Closing/destroying `ChannelOutputStream` object does not close the selector therefore it retains redundant pipes/FD that cen be seen using lsof command or ls /proc/

* Close `TcpNioConnection.ChannelOutputStream.selector` in the `ChannelOutputStream`
* Close `TcpNioConnection.ChannelOutputStream` when connection is closed
* Code style clean up

**Cherry-pick to `5.3.x` & `5.4.x`**

# Conflicts:
#	spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNioConnection.java
2022-01-05 17:05:30 -05:00
Artem Bilan
7922c421ec Fix TcpSenderTests for actual interceptors API 2022-01-03 13:17:14 -05:00
Artem Bilan
b4a56e60b8 Fix AbstractCF around sender property
The `senders` list was introduced starting version `5.4`
2022-01-03 13:05:32 -05:00
Gary Russell
f907a15c16 GH-3701: Fix Possible TCP Memory Leak
Resolves https://github.com/spring-projects/spring-integration/issues/3701

Ensure `TcpSender.removeDeadConnection` is always called, for example when
intercepted and closed via `factory.closeConnectionId` or when closed
connections are harvested from the `connections` map.

**Cherry-pick to 5.4.x, 5.3.x**
# Conflicts:
#	spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/AbstractConnectionFactory.java
2022-01-03 12:38:34 -05:00
Artem Bilan
e4320a434d Fix import for JavaUtils
**Cherry-pick to `5.3.x`**
2021-12-13 14:47:42 -05:00
Artem Bilan
49bcb03b5d GH-3688: Fix WS DSL for proper values propagation
Fixes https://github.com/spring-projects/spring-integration/issues/3688

The `WebServiceTemplate` is populated with some defaults from its ctor.
We should rely on the target default template values as much as possible
and don't override them to `null` if end-user doesn't ask about that explicitly

* Fix `BaseWsOutboundGatewaySpec` extensions to populate values to the target gateway
only if they are not null - therefore provided by end-user
* If end-user wants them explicitly `null`, it is better to do that via
externally configured template.
See overloaded variants for DSL: `Ws.marshallingOutboundGateway(WebServiceTemplate)`
and `Ws.simpleOutboundGateway(WebServiceTemplate)`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-12-13 14:28:56 -05:00
Artem Bilan
2c0663203e Downgrade org.ajoberstar.grgit to 4.0.2 for JVM
It looks like something has been changed in the transitive dependencies of the plugin:
```
org/eclipse/jgit/storage/file/FileRepositoryBuilder has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
```

* Try to downgrade to see and effect without moving to Java 11
2021-12-07 12:34:04 -05:00
Ruslan Stelmachenko
ad159df647 GH-3683: Always new TX in DefaultLockRepository
Fixes https://github.com/spring-projects/spring-integration/issues/3683

If a transaction is already active while `JdbcLockRegistry` uses
`DefaultLockRepository` to acquire/release a lock, the repository
must execute SQL queries in a separate transaction to prevent
problems with blocking, deadlocking etc.

It also allows to properly follow transaction isolation level that
is set on some methods of `DefaultLockRepository`.

Previously all methods of DefaultLockRepository supported the current
transaction if there are any. Now all methods will always create new
transaction on each call.

* Change tests to be more unit-ish
* Change `@since` for the `DefaultLockRepositoryTests` to `5.3.10`

**Cherry-pick to `5.4.x` & `5.3.x`**

# Conflicts:
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/DefaultLockRepository.java
2021-12-07 11:48:16 -05:00
Artem Bilan
80c146c030 GH-3675: Restore nativeHeaders for WebSocketInChA
Fixes https://github.com/spring-projects/spring-integration/issues/3675

The `WebSocketInboundChannelAdapter` removes a `SimpMessageHeaderAccessor.NATIVE_HEADERS`
from headers used to create an outbound message.
Turns out not all native headers are mapped by the `StompHeaderAccessor`
to the top-level header entries.

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-11-15 15:36:12 -05:00
Mauro Molinari
f16f5c6867 GH-3652: File gateway: don't try delete no file
Fixes spring-projects/spring-integration#3652

Do not try to delete non-existing file in `FileExistMode.REPLACE` in the `AbstractRemoteFileOutboundGateway`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-11-03 10:08:09 -04:00
Gary Russell
e50209d045 GH-3648: Fix @Gateway.payloadExpression
Resolves https://github.com/spring-projects/spring-integration/issues/3648

When configuring a gateway proxy with XML, but specifying the payload expression
on the method `@Gateway` annotation, the expression was ignored, even though it
had been parsed.

`@Payload` worked.

With this change, if both `@Payload` and `@Gateway` are defined on a gateway method,
`@Gateway.payloadExpression` wins.

* Fix doc links.
# Conflicts:
#	src/reference/asciidoc/whats-new.adoc
2021-10-20 15:11:45 -04:00
Anthony Schweigard
4e6ce367d0 GH-3641: Handle duplicate cookies properly
Fixes https://github.com/spring-projects/spring-integration/issues/3641

When a duplicate cookie name appears in a request, an `IllegalStateException` is thrown.
The default `Collectors.toMap()` does not allow a duplicated keys.

* Handle `servletRequest.getCookies()` as a `MultiValueMap`
* Call `toSingleValueMap()` for the evaluation context variable to restore previous behavior.
The next major version must expose the `MultiValueMap` as is to give access to all cookies from end-user expressions
* Rework some HTTP tests to JUnit 5

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-10-19 13:40:31 -04:00
Gary Russell
de06767c2e GH-3620: Fix Shared SFTP Session
Resolves https://github.com/spring-projects/spring-integration/issues/3620

Shared session field was captured outside of the lock, causing multiple sessions
in a multi-threaded environment.

**cherry-pick to 5.4.x, 5.3.x**
2021-08-30 10:52:09 -04:00
Spring Builds
708114c699 [artifactory-release] Next development version 2021-08-17 18:02:51 +00:00
Spring Builds
1369455b56 [artifactory-release] Release version 5.3.9.RELEASE 2021-08-17 18:02:47 +00:00
Artem Bilan
ff632504f3 Update dependencies; prepare for release 2021-08-17 11:45:34 -04:00
Artem Bilan
ef79bb782b Fix generics for customizeMonoReply()
Related to: https://stackoverflow.com/questions/68637283/how-to-customize-response-in-spring-integration-using-webflux-when-a-specific-er

The function provided for the `ConsumerEndpointSpec.customizeMonoReply()` may convert
incoming value to something else.
With wildcards it cannot be compiled without casting.

* Add `<T, V>` generic arg for the `customizeMonoReply()` to conform in and out types carrying.
* Modify `WebFluxDslTests` to demonstrate the problem and confirm the fix

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-08-09 15:13:26 -04:00
Dave G
c70c98b945 GH-3610: Fix WebFluxMH for error handling
Fixes https://github.com/spring-projects/spring-integration/issues/3610

This fix changes the WebFluxRequestExecutingMessageHandler
The change specifically changes the contruction of the
WebClientResponseException to use the `create` factory method.

* Added changes and unit test to cover updated code

Updated code to use simplified exception construction that is more tolerant
  of larger payloads.
Updated unit tests to check for specific exception types.

* Corrected checkstyle errors

Corrected checkstyle error in imports.
Corrected whitespace between casts.
Corrected trailing whitespace.

* Added @author

**Cherry-pick to `5.4.x` & `5.3.x`**
# Conflicts:
#	spring-integration-webflux/src/main/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandler.java
#	spring-integration-webflux/src/test/java/org/springframework/integration/webflux/outbound/WebFluxRequestExecutingMessageHandlerTests.java
2021-08-09 13:40:36 -04:00
Artem Bilan
125ac454f5 Fix pattern how Lock.unlock() is used
Related to https://build.spring.io/browse/INT-MAIN-84/

The `lock.unlock()` must be called in the `finally` block of the
nested `try..catch`, not in the outer which may just fail on `lock.lockInterruptibly()`
in which case there is just not going to be anything we can `unlock()` in the end

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-19 17:09:12 -04:00
Artem Bilan
9ebe1b3913 Make MessageHistory JSON-serializable
* Add `org.springframework.integration.history` to trusted default packaged of the `JacksonJsonUtils`
* Add `@JsonCreator` to `MessageHistory` `private` ctor to let it to be created automatically by Jackson
* Add `equals()` and `hashCode()` into `MessageHistory` for the proper `Message` comparison
* Add  `MessageHistory` into headers for testing with Redis JSON (de)serialization

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-19 15:47:29 -04:00
Gary Russell
e714f693cf GH-3589: Reduce Delay on NIO Connection
Resolves https://github.com/spring-projects/spring-integration/issues/3589
2021-07-15 11:43:16 -04:00
Artem Bilan
1d769b8e9d Fix SourcePollingChAdFB autoStartup propagation
The `spring.integration.properties` can come with the `noAutoStartup`
property where we can specify a source polling channel adapter endpoint to
not start automatically.
Turns out the `SourcePollingChannelAdapterFactoryBean` propagates its
`autoStartup` property unconditionally which will skip the `noAutoStartup` value
because an `AbstractEndpoint.setAutoStartup()` sets an `autoStartupSetExplicitly` state

* Fix `SourcePollingChannelAdapterFactoryBean` to rely on a `Boolean` object state
and don't call target endpoint `setAutoStartup()` if it was not set
* Adjust `spring.integration.properties` in tests to use `noAutoStartup`
for some `SourcePollingChannelAdapterFactoryBean`
* Verify that property was applied in the `IntegrationFlowTests.testWithSupplierMessageSourceImpliedPoller()`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-07 14:20:44 -04:00
Artem Bilan
37e6457561 Remove unused imports
**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 15:52:51 -04:00
Artem Bilan
46f83f7afb Fix NPE for @Indexed in the MessagingGatewayReg
The `@Indexed` comes without any attributes, but it is included
into a chain via `importingClassMetadata.getMetaAnnotationTypes(ann)`.
So, skip attributes from meta annotation when it is `null`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 15:29:25 -04:00
Artem Bilan
87e11d21f8 Fix CORS registration for IntGraphController
We fail with `NoClassDefFoundError` when we use `@EnableIntegrationGraphController`
in WebFlux env without Spring MVC.
Another issue that we don't register CORS for WebFlux

* Extract top-level package protected classes for MVC and WebFlux to register CORS
in the appropriate environment according classpath
* Adjust `HttpIntegrationConfigurationInitializer` and `WebFluxIntegrationConfigurationInitializer`
for native compatibility
* Add `@Indexed` for `@MessagingGateway` for indexer support in Spring Boot and Spring Native

**Cherry-pick to `5.4.x` & `5.3.x`**

# Conflicts:
#	spring-integration-http/src/main/java/org/springframework/integration/http/config/IntegrationGraphControllerRegistrar.java

# Conflicts:
#	spring-integration-http/src/main/java/org/springframework/integration/http/config/HttpIntegrationConfigurationInitializer.java
#	spring-integration-webflux/src/main/java/org/springframework/integration/webflux/config/WebFluxIntegrationConfigurationInitializer.java
2021-07-01 14:55:37 -04:00
Spring Builds
ae263d2e1a [artifactory-release] Next development version 2021-06-09 19:20:34 +00:00
Spring Builds
50e20a9263 [artifactory-release] Release version 5.3.8.RELEASE 2021-06-09 19:20:29 +00:00
Artem Bilan
75780404d7 Upgrade dependencies; prepare for release 2021-06-09 14:35:05 -04:00
Frank Pavageau
0964a8984b GH-3570: Disable the generation of the Gradle metadata
Fixes spring-projects/spring-integration#3570

The module file with the Gradle metadata cannot be published on Maven
Central, which causes issues for some people using a repository manager such
as Artifactory. If it doesn't return a 404 HTTP status, the build fails
instead of ignoring the module.

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-05-27 12:20:21 -04:00
Artem Bilan
2a3a548e46 Migrate JDBC lock tests from Derby to H2 2021-05-26 13:46:50 -04:00
Artem Bilan
4e24cbf848 Simplify the test for JDBC lock
https://build.spring.io/browse/INT-SI53X-97
2021-05-26 10:51:20 -04:00
Culebras
5938ab2fc0 GH-3567: JdbcLockRegistry: Retry TransactionSysEx
Fixes https://github.com/spring-projects/spring-integration/issues/3567

* Retry for TransactionSystemException in JdbcLockRegistry

* Unit test added for `TransactionSystemException`

* Completing author and copyright year information

**Cherry-pick to `5.4.x` & `5.3.x`**
# Conflicts:
#	spring-integration-jdbc/src/main/java/org/springframework/integration/jdbc/lock/JdbcLockRegistry.java
2021-05-26 09:57:34 -04:00
Artem Bilan
de4b8e1b5c Upgrade to SA-2.2.17; fix compatibility 2021-05-17 12:02:53 -04:00
Artem Bilan
09e5a1cf7e GH-3560 Parse mail FROM as comma-delimited header (#3562)
Fixes https://github.com/spring-projects/spring-integration/issues/3560

According RFC 5322 `FROM` and `REPLY-TO` received mail message can be
as an array of addresses.

* Fix `MailUtils` to present those arrays as comma-delimited strings for
Spring message headers
* Fix tests to deal already with several addresses for `FROM` mime header.

In the future we may change the logic to map those mime headers to arrays
as it states according the mentioned RFC

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-05-05 17:01:26 -04:00
Artem Bilan
c682309edb GH-3558: Kotlin DSL: propagate generics info (#3561)
Fixes https://github.com/spring-projects/spring-integration/issues/3558

Kotlin lambdas mostly used to configure endpoints in DSL manner
are not really Java lambdas, but rather anonymous classes implementing
respective Java interfaces.

While in most cases such classes carry generic info for their method impls
properly in Java, it is somehow doesn't work well for `GenericHandler`
implemented by Kotlin lambdas

* Wrap provided `GenericHandler` in the `BaseIntegrationFlowDefinition.handle()`
into a Java lambda and call `handle()` recursively to carry an expected type to
the `LambdaMessageProcessor`
* Fix `LambdaMessageProcessor` to handle `ClassUtils.isKotlinUnit()` result of
an invocation as a `null` reply

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-05-05 15:56:39 -04:00
Artem Bilan
e643477dfb GH-3554: Eval remote dir on each synchToLocal (#3556)
* GH-3554: Eval remote dir on each synchToLocal

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

The `remoteDirectoryExpression` was introduced into an
`AbstractInboundFileSynchronizer` to let end-user to evaluate a remote directory
on each poll (essentially on each `synchronizeToLocalDirectory()` call).
The fix for the https://jira.spring.io/browse/INT-4491 introduced a regression
when such an expression was evaluated only once when we call a `setRemoteDirectory()`.
So, an original purpose of this option was lost and we don't get an actual
remote dir on each poll

* Remove `evaluateRemoteDirectory()` method and its usage since it doesn't
reflect expectation of the remote dir expression property
* Reinstate the `remoteDirectoryExpression` evaluation in the
`synchronizeToLocalDirectory()`
* Propagate the result of that expression into further methods for copying
files
* Remove setting of the `remoteDirectory` variable into a global `EvaluationContext`
of the `AbstractInboundFileSynchronizer` instance since it is not thread-safe
* Instead create an `EvaluationContext` locally for each `synchronizeToLocalDirectory()`
call and set the `remoteDirectory` variable into this scoped instances
* Generate a local file name from the `localFilenameGeneratorExpression`
against locally created `EvaluationContext` with the mentioned `remoteDirectory` variable
* Cover the expected functionality with a unit-test

**Cherry-pick to `5.4.x` & `5.3.x`**

* * Fix `testRemoteDirectoryRefreshedOnEachSynchronization` according PR review
2021-04-27 16:46:28 -04:00
Artem Bilan
9981a71ec7 Fix breaking change for PersistentFileListFilter
The `AbstractPersistentAcceptOnceFileListFilter`
extends now an `AbstractDirectoryAwareFileListFilter`
and makes all the implementors to implement its `isDirectory()` method.
This is a breaking change in the point release which makes implementations
outside of the core project not compilable

The regression after: https://github.com/spring-projects/spring-integration/issues/3488
Related fix in the Spring Cloud GCP: https://github.com/spring-cloud/spring-cloud-gcp/pull/2654

* Implement an `isDirectory()` in the `AbstractPersistentAcceptOnceFileListFilter`
to let other implementations do not worry during upgrade

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-04-21 11:22:49 -04:00
Spring Buildmaster
b7e7e18d84 [artifactory-release] Next development version 2021-04-14 14:54:30 +00:00
Spring Buildmaster
849c22defd [artifactory-release] Release version 5.3.7.RELEASE 2021-04-14 14:54:26 +00:00
Artem Bilan
696f490fd8 Upgrade dependencies; prepare for release 2021-04-14 10:32:53 -04:00
Alexander Pinske
c6ecd90abe Fix IMAP race condition around idle()
`IMAPFolder.idle()` by default keeps idle-ing after each response.
We don't need that, because we want to fetch the new mails immediately (over the same connection).
To make `idle()` not keep on going, we called
`folder.isOpen()` which in most cases makes `idle()` stop by calling `noop()`
internally (to keep the connection alive) which leads to the current
`idle()`-call being canceled.

The problem this commits addresses is that the call to `noop()` only
happens if there were no calls in the last second.
There is a check for that in `com.sun.mail.imap.IMAPFolder.keepConnectionAlive`.
So if a new message appears less then a second after idle started, we will miss it.

This new way interrupts `idle()` more often than before, e.g. when there
is an expunge-message (i.e. a message was deleted), which we don't care about.
But the subsequent `receive()` in IdleTask will simply get no
messages and then turn around and start idle-ing again.

**Cherry-pick to `5.3.x` & `master`**

# Conflicts:
#	spring-integration-mail/src/main/java/org/springframework/integration/mail/ImapMailReceiver.java
#	spring-integration-mail/src/test/java/org/springframework/integration/mail/ImapMailReceiverTests.java
2021-04-06 14:05:56 -04:00
Gary Russell
d6a4422aa9 GH-536: Fix test for backport 2021-03-25 18:46:35 -04:00
Gary Russell
dc51a8cbf3 GH-3526: Fix Infinite Loop in FailoverCConnFactory
Resolves https://github.com/spring-projects/spring-integration/issues/3526

`FailoverClientConnectionFactory`

The logic to detect we had iterated over all factories and including
the one from which the previous connection was established was incorrect,
causing an infite loop until one of the factory connections was successful.

Change the logic to detect we have reset the iterator and the current failure
is from the same factory as the one from which the previous connection was
established.

**cherry-pick to 5.4.x, 5.3.x**

* Add diagnostics.

* Fix race in test.

* More race fixes and diagnostics.

* Remove diagnostics.
2021-03-25 17:50:51 -04:00
Artem Bilan
a7843af045 GH-3521: Delayer: schedule release task with TX (#3525)
* GH-3521: Delayer: schedule release task with TX

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

There is a race condition when transactional `MessageStore` is used
for `DelayHandler`, so the message is not visible for reads until after TX is
committed, but a scheduled release task may be already ready after delay

* Register a `TransactionSynchronization` with scheduling a releasing task
when TX is committed

**Cherry-pick to `5.4.x` & `5.3.x`**

* Fix language in delayer.adoc

Co-authored-by: Gary Russell <grussell@vmware.com>

Co-authored-by: Gary Russell <grussell@vmware.com>
2021-03-24 11:15:11 -04:00
Trung Pham
d016dd5b6f GH-3507: Fix Tail producer for proper command
Fixes https://github.com/spring-projects/spring-integration/issues/3507

The `OSDelegatingFileTailingMessageProducer` passing command string to `Runtime.getRuntime().exec()`
may cause problems if spaces (and other special characters) are used in the filename.

* Use an array for command and its options to let the target `Runtime` to parse and
execute it properly

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

# Conflicts:
#	spring-integration-file/src/main/java/org/springframework/integration/file/tail/OSDelegatingFileTailingMessageProducer.java
2021-03-11 14:26:45 -05:00
Artem Bilan
b7d9b87201 GH-3497: ReplyProducerCleaner: check only MPs
Fixes https://github.com/spring-projects/spring-integration/issues/3497

The `BaseIntegrationFlowDefinition.REFERENCED_REPLY_PRODUCERS` is filled up
only with the `MessageProducer` instances.
Therefore no reason to calculate a hash code for every single bean passed
to the `ReplyProducerCleaner.requiresDestruction()`

* Check for the `MessageProducer` instance before passing the bean to the
`BaseIntegrationFlowDefinition.REFERENCED_REPLY_PRODUCERS.contains()`
* Check for the `MessageProducer` in the `ReplyProducerCleaner.postProcessBeforeDestruction()`,
too.
It can be called independently of the `requiresDestruction()` and will calculate a hash code
from the bean again for nothing

**Cherry-pick to 5.4.x & 5.3.x**
2021-02-22 13:16:11 -05:00
Spring Buildmaster
a0fd6839b0 [artifactory-release] Next development version 2021-02-17 19:05:56 +00:00