Commit Graph

10636 Commits

Author SHA1 Message Date
Artem Bilan
d7a7bbbf75 GH-3601: Bring AMQP byte code compatibility back
Fixes https://github.com/spring-projects/spring-integration/issues/3601

The issue https://github.com/spring-projects/spring-integration/issues/3584
has introduced a regression when old constructor with an
`AbstractMessageListenerContainer` was removed in favor of just
`MessageListenerContainer`.
But with that change all the dependant projects must be recompiled,
which is not a case when Spring Cloud was not released against the
latest Spring Boot.

**Cherry-pick to `5.4.x`**
2021-07-30 13:43:37 -04:00
Gary Russell
fba4b20451 GH-3600: Fix Kafka Tx Synchronization
Resolves https://github.com/spring-projects/spring-integration/issues/3600

Previously, the `KafkaProducerMessageHandler` did not synchronize a transaction
with some other transaction (e.g. JDBC); it published in a local transaction instead.

Also configure the Gradle Kotlin Daemon to work with JDK 16.

**cherry-pick to 5.4.x**
2021-07-28 11:56:05 -04:00
Spring Builds
ab7cc9fcc1 [artifactory-release] Next development version 2021-07-26 19:54:17 +00:00
Spring Builds
73c042c7cb [artifactory-release] Release version 5.4.9 2021-07-26 19:54:11 +00:00
Artem Bilan
bed7640b83 Upgrade dependencies; prepare for release 2021-07-26 15:18:53 -04:00
Gary Russell
2858954971 GH-3584: Support spring-amqp 2.3.x and 2.4.x
# Fix deprecation warning for Reactor's `limitRequest()`
2021-07-26 13:30:55 -04:00
Artem Bilan
ddab28a06f 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:08:46 -04:00
Artem Bilan
70f6ceb5b9 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:46:48 -04:00
Artem Bilan
f0d126037f 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 13:49:00 -04:00
Artem Bilan
ed47b566b9 Remove unused imports
**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 15:52:14 -04:00
Artem Bilan
836a11be6a 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:04 -04:00
Artem Bilan
46acf0cc83 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
2021-07-01 14:49:22 -04:00
Spring Builds
a6d5ed672c [artifactory-release] Next development version 2021-06-23 18:32:08 +00:00
Spring Builds
1a0bcb81f1 [artifactory-release] Release version 5.4.8 2021-06-23 18:32:03 +00:00
Artem Bilan
dd4c12ae75 Upgrade dependencies; prepare for release 2021-06-23 13:26:49 -04:00
Frank Pavageau
9d7ef206b7 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:19:35 -04:00
Mário Dias
ec8a747261 GH-3509: Fix regression in TcpNetServerConnectionFactory
Related to https://github.com/spring-projects/spring-integration/issues/3509

* Fix intercepted connection cleanup tests
* Add missing logic to call `setSenders()` on wrapped connection

**Cherry-pick to `5.4.x`**
2021-05-26 11:28:58 -04:00
Culebras
9bab07d21d 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`**
2021-05-26 09:55:28 -04:00
Spring Builds
bb61a7d4be [artifactory-release] Next development version 2021-05-18 16:09:52 +00:00
Spring Builds
d96d653095 [artifactory-release] Release version 5.4.7 2021-05-18 16:09:47 +00:00
Artem Bilan
07fffe2b43 Upgrade dependencies; prepare for release 2021-05-18 11:35:08 -04:00
Artem Bilan
7ce31734ac Upgrade dependencies; fix compatibility in tests 2021-05-17 13:25:06 -04:00
Artem Bilan
56474a5ef5 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 16:56:52 -04:00
Artem Bilan
d5ff74b272 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:10 -04:00
Artem Bilan
7aaef1e9ae 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:37:23 -04:00
Artem Bilan
7da58b37c1 Fix ZeroMQ components initialization
SO: https://stackoverflow.com/questions/67214907/zeromq-with-spring-spring-integration-zeromq

The `Mono` is created in several places in ZeroMQ components from their constructors.
That leads to the reactive stream to be configured just after ctor, which will ignore
any changes to the options which are used from that `Mono` definition.
For example this code `.doOnNext(this.sendSocketConfigurer)` is done once during
reactive stream definition.

* Fix all the ZeroMQ components to defer usage of the options which could be changed
after ctor initialization
* Cover affected option changes in the tests

**Cherry-pick to `5.4.x`**
2021-04-22 12:45:12 -04:00
Artem Bilan
f97e44f59f 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:22 -04:00
Spring Buildmaster
3d1b04883b [artifactory-release] Next development version 2021-04-14 15:10:49 +00:00
Spring Buildmaster
abc58968bc [artifactory-release] Release version 5.4.6 2021-04-14 15:10:45 +00:00
Artem Bilan
184a6c2f43 Upgrade dependencies; prepare for release 2021-04-14 10:46:29 -04:00
Artem Bilan
a869e8a209 Revise retry for IntegrationReactiveUtils (#3543)
Related to: https://github.com/spring-cloud/stream-applications/issues/156

The `IntegrationReactiveUtils` uses a general `Flux.retry()`
operator to always retry for all the errors.
On the other hand it has only a `.doOnError(MessagingException.class)`
which leads swallowing all the other exceptions from logs and handling.

* Replace with `retryWhen()` for the `MessagingException` predicate
failing for all other exceptions.
The end-user may add their own `retry` or error handling mechanism to
the returned `Flux` from the `IntegrationReactiveUtils`

**Cherry-pick to 5.4.x**
2021-04-09 15:06:43 -04:00
Alexander Pinske
c392d389c6 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`**
2021-04-06 14:01:10 -04:00
Gary Russell
b9704e1dca GH-536: Fix test for backport 2021-03-25 18:47:05 -04:00
Gary Russell
5e6a6a2076 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:47:59 -04:00
Artem Bilan
c5e24fb301 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:12:29 -04:00
Gary Russell
2d443f9143 GH-3523: TcpConnectionEvent Fixes
Resolves https://github.com/spring-projects/spring-integration/issues/3523

- `TcpNetConnection` - publish open event on reader thread to avoid race with first read.
- Intercepted connections - Ensure that the event source is always the outermost interceptor.
- Also reduce delays during NIO client connect.

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

5.3.x will require cherry picking GH-3509 commits.

# Conflicts:
#	spring-integration-ip/src/main/java/org/springframework/integration/ip/tcp/connection/TcpNetServerConnectionFactory.java
2021-03-23 13:28:42 -04:00
Spring Buildmaster
29a4729ea3 [artifactory-release] Next development version 2021-03-17 22:57:06 +00:00
Spring Buildmaster
eaeb12b06b [artifactory-release] Release version 5.4.5 2021-03-17 22:57:03 +00:00
Gary Russell
e63da312f9 GH-3509: Fix if test in previous commit
Caused interceptor to be skipped.

**cherry-pick to 5.4.x**

* Fix race in new tests

* Remove overloaded conn id in test interceptor.
2021-03-17 18:34:06 -04:00
Gary Russell
81c3b7dca6 GH-3509: Fix Memory Leak with Intercepted TCP Conn
Resolves https://github.com/spring-projects/spring-integration/issues/3509

When a connection was intercepted, the `TcpSender.add...` was called with the
interceptor, but the `removeDead...` was called with the actual connection,
causing a memory leak.

Always call the `TcpSender` with the outer-most interceptor.
2021-03-17 17:51:21 -04:00
Artem Bilan
a14502ba86 Upgrade dependencies; prepare for release 2021-03-17 14:41:13 -04:00
Artem Bilan
3d6015b54d Revert "GH-3509 Register TcpSenders on wrapped connection"
This reverts commit 1e67a94af9.

See https://github.com/spring-projects/spring-integration/pull/3514 for more info
2021-03-17 14:25:53 -04:00
Mário Dias
1e67a94af9 GH-3509 Register TcpSenders on wrapped connection
Fixes https://github.com/spring-projects/spring-integration/issues/3509

Dead connections are not being removed on `TcpSender` when using a `TcpConnectionInterceptor`.
May cause a memory leak

* Fix `TcpConnectionInterceptorSupport` to override `registerSenders()`
 and delegate to the `this.theConnection`
* Introduce vararg-based `setInterceptor()` into `TcpConnectionInterceptorFactoryChain`
* Remove redundant `//NOSONAR` and properly return an `Arrays.copyOf()` in the `getInterceptorFactories()`

**Cherry-pick to `5.4.x`**
2021-03-12 15:49:10 -05:00
Trung Pham
51f2188d43 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**
2021-03-11 14:20:25 -05:00
Artem Bilan
871c1bc8f1 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:34 -05:00
Spring Buildmaster
41cf8b3f47 [artifactory-release] Next development version 2021-02-17 19:33:49 +00:00
Spring Buildmaster
59425111bf [artifactory-release] Release version 5.4.4 2021-02-17 19:33:45 +00:00
Artem Bilan
2d04f512f4 Upgrade dependencies; prepare for release 2021-02-17 13:50:14 -05:00
Artem Bilan
dd96f956d3 Fix compatibility with Java 8 compiler
**Cherry-pick to 5.3.x**
2021-02-05 17:11:03 -05:00
Artem Bilan
11e1cc2511 Fix code typo from the previous commit
**Cherry-pick to 5.3.x**
2021-02-05 17:01:26 -05:00