Commit Graph

10935 Commits

Author SHA1 Message Date
Artem Bilan
469bd6ba04 GH-3816: Fix MongoDb module for the latest SD
Fixes https://github.com/spring-projects/spring-integration/issues/3816

The `MappingMongoConverter` now used different path when it
iterates documents form conversion from a DB cursor

* Fix `MongoDbMessageStore.MessageReadingMongoConverter` to override
a `read(TypeInformation<S>, Bson)` method to convert a `MessageWrapper` properly
* Upgrade to the latest MongoDb driver
2022-05-27 14:40:58 -04:00
Artem Bilan
ab6060fb2d The testWindowTimespan() is time-sensitive
The `FluxAggregatorMessageHandlerTests.testWindowTimespan()`
relies on the time-based window function of `100` millis.
Looks like a delay of `Thread.sleep(20)` may cause a resources race
condition and window is released only with one item.

* Disable `testWindowTimespan()` since there is no guarantee with what
timing settings it is going to work stably

**Cherry-pick to `5.5.x`**
2022-05-27 12:44:12 -04:00
Artem Bilan
5a42d7137a Deprecate TestUtils.dockerRegistryFromEnv()
The Testcontainers rely on the `TESTCONTAINERS_HUB_IMAGE_NAME_PREFIX` ENV var
and build proper image name automatically.

* Deprecate `TestUtils.dockerRegistryFromEnv()` and remove its usage in the project
2022-05-27 12:44:12 -04:00
Artem Bilan
a614e4bdf9 Really reuse Testcontainers
The `withReuse(true)` and `testcontainers.reuse.enable=true` don't work together with `@Container`.
The JUnit extension gathers those containers and stop them in the end of test class unconditionally.

* Remove `@Container` annotation usage
* Use `@BeforeAll` and `GenericContainer.start()` manually
This way the container ensures to reuse existing running container and don't start a fresh one.
Since the container instance is stored in a `static` property, it is really started only once.
The rest tests in a suite just reuse that existing container.
Ryuk container will take care about their stopping and removal eventually afte JVM exit.

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

# Conflicts:
#	spring-integration-jdbc/src/test/java/org/springframework/integration/jdbc/mysql/MySqlContainerTest.java
2022-05-27 12:44:12 -04:00
Matthias Stock
c091a2d125 Removed dead link from jdbc.adoc
The linked resource is not available anymore:
https://web.archive.org/web/20210228160648/https://blog.engineyard.com/5-subtle-ways-youre-using-mysql-as-a-queue-and-why-itll-bite-you
2022-05-27 12:44:12 -04:00
Spring Builds
77ab988c59 [artifactory-release] Next development version 2022-05-27 12:44:07 -04:00
Spring Builds
994b176fc6 [artifactory-release] Release version 5.5.12 2022-05-27 12:43:55 -04:00
Artem Bilan
409d4d9358 Upgrade dependencies; prepare for release 2022-05-17 15:18:45 -04:00
Artem Bilan
3a8f3d8edb GH-3800: Fix Kotlin docs for route() DSL
Fixes https://github.com/spring-projects/spring-integration/issues/3800

* Mention `Message` as a type for reified generic argument in Kotlin DSL docs

**Cherry-pick to `5.5.x`**
2022-05-17 15:05:01 -04:00
Artem Bilan
b156e196ca GH-3794: Use less memory with scheduled tasks
Fixes https://github.com/spring-projects/spring-integration/issues/3794

* Replace hard reference to message group with its `id` in the
`AbstractCorrelatingMessageHandler.removeEmptyGroupAfterTimeout()`
* Replace hard reference to message with its `id` in the
`DelayHandler.rescheduleAt()`

**Cherry-pick to `5.5.x`**
2022-05-10 14:34:51 -04:00
Artem Bilan
f64ad0f509 GH-3785: Close stream for persistent collection (#3786)
* GH-3785: Close stream for persistent collection

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

* Fix `CollectionArgumentResolver` and `PayloadsArgumentResolver` to
close the `Stream` of message after its usage
* Rework `AbstractKeyValueMessageStore.removeMessagesFromGroup()`
to iterate input collection of messages not its stream to avoid
the mentioned problem

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

* * Add `JdbcMessageStoreTests.testMessageGroupStreamNoConnectionPoolLeak()`
to ensure that no leaks in the connection pool anymore.
* Improve `MessageGroupStore.streamMessagesForGroup()` JavaDocs about
requirements to close the `Stream` from persistent message store impls
2022-04-25 10:19:10 -04:00
Spring Builds
6788cc9a27 [artifactory-release] Next development version 2022-04-19 15:02:38 +00:00
Spring Builds
837f8ff00f [artifactory-release] Release version 5.5.11 2022-04-19 15:02:34 +00:00
Artem Bilan
cd73b61ffe Upgrade dependencies; prepare for release
* Make `artifactoryPublish` `dependsOn build` to ensure
that artifacts are not deployed until tests pass
2022-04-19 10:25:01 -04:00
Artem Bilan
f5efa0deac GH-3765 Resolve Lookup ctor lazily via reflection
Fixes https://github.com/spring-projects/spring-integration/issues/3765

The `DefaultMethodInvokingMethodInterceptor` has several strategies
for `default` method invocations in the messaging gateway.
One of them is based on the `Lookup` constructor which causes
a `WARNING: An illegal reflective access operation has occurred`.
This can be done lazily when there is no `MethodHandles.privateLookupIn`
in Java version used for the project.

* Fix `OPEN` enum value for the `Constructor<Lookup>` to be resolved in
a lazy manner via `Supplier` and `boolean` flag

**Cherry-pick to `5.5.x`**
2022-04-11 14:29:55 -04:00
Artem Bilan
c75be107fa Close mail folder if no messages to produce
Related to https://stackoverflow.com/questions/71667731/spring-integration-mimemessage-gmail-folder-is-not-open-exception

If no mail messages pulled from the folder or all of them are filtered out,
there is nothing to produce downstream.
Therefore, always close the folder in the end of `AbstractMailReceiver.receive()`
when no messages and even if `autoCloseFolder == false`

**Cherry-pick to `5.5.x`**
2022-04-07 14:16:39 -04:00
Artem Bilan
de4b3a3e11 Removed unused import 2022-03-29 09:23:33 -04:00
Artem Bilan
b64577262b Remove Werror option from JavaDoc config
This option is not available in Java 11 yet
2022-03-28 11:34:16 -04:00
Artem Bilan
6d86a15221 Enforce Java with Gradle options.release = 8
* Add suppressions for JavaDoc warnings
* Fix some tests for Java 17 compatibility
2022-03-28 11:28:43 -04:00
Artem Bilan
81f5b6bbbd Fix JacksonJsonUtils for Java 8 compatibility 2022-03-24 13:08:27 -04:00
Artem Bilan
dfaf5001fe Fix AMQP test for NPE from mocks
https://build.spring.io/browse/INT-MAIN-261/

**Cherry-pick to `5.5.x`**
2022-03-23 15:40:00 -04:00
Gary Russell
343be47c04 RGH-1439: AMQP: Log Warn For Misconfigured Confirm
See https://github.com/spring-projects/spring-amqp/issues/1439

**cherry-pick to 5.5.x*
2022-03-23 15:01:52 -04:00
Spring Builds
f9dada39b7 [artifactory-release] Next development version 2022-03-22 21:08:42 +00:00
Spring Builds
e14ac321b9 [artifactory-release] Release version 5.5.10 2022-03-22 21:08:39 +00:00
Artem Bilan
eec3e956fe GH-3734: Support MessageHistory on Kafka deser
Fixes https://github.com/spring-projects/spring-integration/issues/3734

The `MessageHistory` is not in the trusted packages of the `DefaultKafkaHeaderMapper`
therefore it fails when `MessageHistory.read()` is performed.

* Configure default `DefaultKafkaHeaderMapper` in the `SubscribableKafkaChannel`,
`KafkaInboundGateway`, `KafkaMessageDrivenChannelAdapter` and `KafkaMessageSource`
to also trust packages exposed via `JacksonJsonUtils.DEFAULT_TRUSTED_PACKAGES`
which include a `MessageHistory`, too.

* Verify in some integration Kafka tests to be sure that `MessageHistory` is
deserialized properly in the transferred headers
* Rework some tests to use `@EmbeddedKafka` instead of `@BeforeAll/@AfterAll`

**Cherry-pick to `5.5.x`**
2022-03-22 16:02:08 -04:00
Artem Bilan
675b3b4930 Upgrade dependencies; prepare for release 2022-03-22 14:52:15 -04:00
Mikhail Polivakha
4bf606a085 GH-3732: Fix NPE in Mqttv5PahoMessageDrivenChA
Fixes https://github.com/spring-projects/spring-integration/issues/3732

The `Mqttv5PahoMessageDrivenChannelAdapter` unconditionally tries to (un)subscribe
to/from topics when the `mqqtClient` might not be initialized yet.

* Add `mqqtClient` initialization check before adding or removing topic.
Re-align logic with the `MqttPahoMessageDrivenChannelAdapter`

**Cherry-pick to `5.5.x`**
2022-03-18 14:56:25 -04:00
Artem Bilan
575584d2aa Fix Checkstyle violation from the previous commit 2022-03-16 15:25:10 -04:00
Artem Bilan
5e0e620351 Cancel subscription for MPS.subscribeToPublisher
The `Flux.takeWhile()` only works if there is data in the `Publisher`
to consume.
We still need to be able to cancel subscription and stop producing even if
there is no data at the moment.

* Change `takeWhile()` to the `doOnSubscribe()` and store `subscription`
in the `volatile` property of the `MessageProducerSupport`
* Cancel such a subscription in the `doStop()` impl
* Propagate `doStop()` to super in the `ZeroMqMessageProducer`
which is only one reactive channel adapter overriding `doStop()`
* Verify in the `ReactiveMessageProducerTests` that subscription is cancelled
for delayed data in the `Publisher`

**Cherry-pick to `5.5.x`**
2022-03-16 14:52:33 -04:00
Gary Russell
30a2f18551 GH-2750: Deprecate container spec errorHandler
Resolves https://github.com/spring-projects/spring-integration/issues/3750

**5.5.x only; removed in 6.0**
2022-03-16 14:50:44 -04:00
Sorie
bbc4e1e9c0 GH-3744: Fix ServerWebSocketContainer.stop()
Fixes https://github.com/spring-projects/spring-integration/issues/3744

The `ServerWebSocketContainer.stop()` accidentally calls `this.handshakeHandler.start()`

**Cherry-pick to `5.5.x`**
2022-03-09 09:55:19 -05:00
Chris Bono
e80c0ab919 GH-3737: Add serialVersionUID to MessageHistory
Fixes https://github.com/spring-projects/spring-integration/issues/3737

* Add an explicit `serialVersionUID` to `MessageHistory` to avoid class version conflicts in the future.

See related GH issue for the workaround

**Cherry-pick to `5.5.x`**
2022-03-08 16:27:58 -05:00
Spring Builds
963c05ada3 [artifactory-release] Next development version 2022-02-22 17:51:59 +00:00
Spring Builds
c6f0e1984a [artifactory-release] Release version 5.5.9 2022-02-22 17:51:54 +00:00
Artem Bilan
d79c9fdeda Revert JavaDoc options for Java 11 on CI 2022-02-22 11:43:44 -05:00
Artem Bilan
fb05c73969 Upgrade dependencies; prepare for release
* Rework `FeedInboundChannelAdapterParserTests` for Java 17 compatibility
2022-02-22 10:54:23 -05:00
Artem Bilan
b443605ec6 Upgrade to Gradle 7.3.3 for Java 17 compatibility
To simplify project support, it is better to let
this `5.5.x` branch to be build with Java 17
while keeping the old code style and bytecode
for Java 8 compatibility.
2022-02-16 10:07:46 -05:00
Artem Bilan
9b27fbee89 Remove SocketUtils usage
* Remove usage of non-stable `org.springframework.util.SocketUtils`
* Replace it with `0` for those tests where it is possible to select OS port
* Remove the mentioning of the `SocketUtils` from the `testing.adoc`
* Use `TransportConstants.DEFAULT_STOMP_PORT` for `StompServerIntegrationTests`.
We may disable this test in the future for CI if it is not going to be stable
* Introduce `Supplier<String> connectUrl` variants for `ZeroMqMessageHandler`
to let it defer connection evaluation until subscription to the socket `Mono`
in the `ZeroMqMessageHandler`.
* Move connection logic in the `ZeroMqMessageHandler` to `Lifecycle.start()`

Related to https://github.com/spring-projects/spring-framework/issues/28054

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

# Conflicts:
#	spring-integration-stomp/src/test/java/org/springframework/integration/stomp/client/StompServerIntegrationTests.java
2022-02-16 10:02:32 -05:00
Artem Bilan
f8c22dd357 Fix race conditions in JdbcLockRegDifClientTests
The default `TTL` in the `DefaultLockRepository` is 10 seconds which mislead us
when other client instance has just 100 millis.
So, not-adjusted client spins for expired lock wastefully leading to the
synchronization barriers to fail

**Cherry-pick to `5.4.x`**
2022-02-14 09:56:43 -05:00
Almog Tavor
5c23c702e4 Fix sentence error in the overview.adoc
Fix a mistake in a sentence about EIP components and `BeanPostProcessor`
2022-02-08 19:07:39 -05:00
Unseok Kim
6f91929da3 GH-3716 Fix wait for init redisMsgListenContainer
Fixes https://github.com/spring-projects/spring-integration/issues/3716

If the `redisMessageListenerContainer` is starting, waiting for it to complete without doing `subscribeUnlock()`

* Introduce `isRunningRedisMessageListenerContainer` state since the `running` in the `RedisMessageListenerContainer` is set in the beginning of the `start()` misleading on the concurrent calls to the `RedisLockRegistry`

**Cherry-pick to `5.5.x`**
2022-02-08 10:09:11 -05:00
Gary Russell
724f335750 Fix @Poller Javadoc
* Fix @Poller Javadoc - `receiveTimeout` was added as a property in 5.1.
* More javadoc polishing.

**cherry-pick to 5.5.x**
2022-02-03 15:30:34 -05:00
Artem Bilan
f1407544a2 Don't use pattern matching in instanceof
The pattern matching for `instanceof` is available since Java 16
2022-02-03 10:13:59 -05:00
Artem Bilan
25e763d683 GH-3711: Fix HTTP handler for content type header
Fixes https://github.com/spring-projects/spring-integration/issues/3711

The `contentType` header may come with parameter in its media type.

* Fix `AbstractHttpRequestExecutingMessageHandler` to use `equalsTypeAndSubtype()`
ignoring params
* Some other code clean up in the `AbstractHttpRequestExecutingMessageHandler`
* Ensure in the `HttpRequestExecutingMessageHandlerTests.simpleStringKeyStringValueFormData()`
that provided `contentType` header is handled properly
* Fix `HttpProxyScenarioTests.testHttpMultipartProxyScenario()` for mislead multi-part form
handling

**Cherry-pick to `5.5.x`**
2022-02-03 09:42:13 -05:00
Gary Russell
413d66018e GH-3713: Fix Race In Test 2022-02-03 09:24:08 -05:00
Artem Bilan
b9bc10558a ConcurrentHashMap for JdbcMessageStore.queryCache
To avoid a possible `ConcurrentModificationException` it is better to use a
`ConcurrentHashMap` for that `computeIfAbsent()` operation on the cache
2022-02-02 13:00:26 -05:00
Gary Russell
c1aa9b7958 GH-3713: TCP: Fix Intercepted Sender List
Resolves https://github.com/spring-projects/spring-integration/issues/3713

https://github.com/spring-projects/spring-integration/issues/3326 added support
for multiple `TcpSenders`. However, when connections are intercepted, the sender
list was not properly chained through the interceptors.

- override `registerSenders` and properly capture the real senders in the last
  interceptor and intermediate interceptors
- this ensures that `addNewConnection` is called on each interceptor
- when removing dead connections, use the connection sender list insted of the
  factory's raw sender list; detect if the connection is an interceptor and
  call its remove method instead.

**cherry-pick to 5.5.x**
2022-02-02 12:11:54 -05:00
Spring Builds
4423e43cd8 [artifactory-release] Next development version 2022-01-18 18:38:40 +00:00
Spring Builds
182b1cb158 [artifactory-release] Release version 5.5.8 2022-01-18 18:38:37 +00:00
Artem Bilan
6ae6f343c8 Fix typo in the build.gradle 2022-01-18 12:15:54 -05:00