Commit Graph

10593 Commits

Author SHA1 Message Date
Gary Russell
bbc10fa6fc Revert spring-ws to 3.0.10; prepare for milestone 2021-01-20 14:57:02 -05:00
Artem Bilan
eabe891c15 Move dependencies to their milestones/latest GAs 2021-01-20 14:14:08 -05:00
Artem Bilan
f0f2c41ae3 GH-3446: Stream support in the MessageGroupStore
Fixes https://github.com/spring-projects/spring-integration/issues/3446

* For better resources utilization provide a `Stream<Message<?>>` API
on the `MessageGroupStore`, `MessageGroup` and `MessageGroupQueue`
* Use this API in the `DelayHandler` when it reschedules persisted messages
2021-01-20 13:44:08 -05:00
Artem Bilan
51e240b761 GH-3439: Revise error handling in RedisStreamMP
Fixes https://github.com/spring-projects/spring-integration/issues/3439

The latest Spring Data Redis has introduced an `onErrorResume` function
option for the `StreamReceiver` and this one is now recommended way
to handle errors in the `Flux` from this receiver

* Expose all the `StreamReceiver.StreamReceiverOptionsBuilder` option
onto the `ReactiveRedisStreamMessageProducer`, including `onErrorResume`
* Have a default function as it was before - send into an error channel
supporting (n)ack in the failed message based on the failed record
* Make new setters mutually exclusive with an explicit `StreamReceiver.StreamReceiverOptions`

* Doc polishing
2021-01-20 13:36:35 -05:00
Artem Bilan
c003a47379 GH-3437: Add MessageRecoverer to AMQP Inbounds (#3465)
* GH-3437: Add `MessageRecoverer` to AMQP Inbounds

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

For better end-user experience with AMQP Inbound Endpoints, expose
a `MessageRecoverer` option
* Test the feature and document this new option

* * Fix Checkstyle & update Copyright

* Fix language in Docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2021-01-19 17:22:05 -05:00
Artem Bilan
5c7384316a Upgrade dependencies
* Fix compatibility with the latest dependency upgrades
2021-01-15 17:10:07 -05:00
Pierre Lakreb
b58b0e5ffa Make JsonPropertyAccessor returned type directly
* add `Comparable` contract to the initial wrapper so that expressions
containing selection/projection with JsonNode filtering are now possible
* render directly the value of a ValueNode. SpEL parser can now evaluate
correctly the object value when the expression deals with filtering on
`JsonNode` values (<, >, ==...)
* the 2 above changes make this possible:
`property.^[name.getTarget().asText() == 'value1'].name` can now be
written as simply as `property.^[name == 'value1'].name`. The expression
is now fully compatible with other PropertyAccessor types
* rename `ToStringFriendlyJsonNode` to `JsonNodeWrapper` as it reflects
more the capability of the new wrapper
* add a GenericConverter to be able to convert the `JsonNodeWrapper`
class into a `JsonNode` (or its derivative classes) directly while
calling `expression.getValue(..., JsonNode.class)`
* add the possibility to access list items in a json-path like index
	=> a negative number will begin from the end of the list <=
* return null value when `JsonNode` cannot handle the property name
(or index)

* Change Json Converter
* Clean up the code style
* Convert JsonPropertyAccessor tests to JUnit 5
2021-01-14 16:07:40 -05:00
Gary Russell
7a84d6797e Upgrade to spring-amqp 2.3.4
- remove uses of deprecated method
- correctly call delegate in correlation data wrapper

**Cherry-pick to `5.4.x`**
2021-01-13 14:59:54 -05:00
Artem Bilan
478a79c74b GH-3450: Expose PubSub requireSubscribers option (#3459)
* GH-3450: Expose PubSub requireSubscribers option

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

* Add `PublishSubscribeChannel` ctors with the `requireSubscribers` option
with a direct delegation to the same option of underlying `BroadcastingDispatcher`
* Add factory methods to the `Channels` & `MessageChannels` to expose
this new `requireSubscribers` option
* Expose an XML `require-subscribers` attribute for the `<publish-subscribe-channel`
* Document this new `requireSubscribers` option
* Introduce a global `spring.integration.channels.error.requireSubscribers` property
for a default `errorChannel`
* Document this property and explain its default `true` in the `error-handling.adoc`
* Remove docs for `spring.integration.postProcessDynamicBeans` since it purpose was
removed since version `5.1` in favor of "always post-process behavior" as it was
always with all the `BeanPostProcessor`s

* * Fix language in docs according review

* * Add more docs about `requireSubscribers` and cross-links between chapters
2021-01-12 13:35:41 -05:00
Artem Bilan
f294331945 GH-3455: default MqttMessageConverter.toMessage
Fixes https://github.com/spring-projects/spring-integration/issues/3455

After introduction `MqttMessageConverter.toMessageBuilder()`
(https://github.com/spring-projects/spring-integration/issues/3181)
the existing `MqttMessageConverter` must also implement this new method
where in most cases `toMessage()` call `toMessageBuilder()`

* Make `MqttMessageConverter.toMessage()` as a `default` with a delegation
to the `toMessageBuilder()` allowing target implementors to avoid extra
method
2021-01-11 17:03:26 -05:00
Artem Bilan
90ca3d6ea5 GH-3454: From MQTT conversion error - to error ch (#3456)
* GH-3454: From MQTT conversion error - to error ch

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

The message converter may return null when we try to covert from the
MQTT message.
The thrown exception may also reset the client connect.

* Fix `MqttPahoMessageDrivenChannelAdapter` to catch any conversion errors
(including `null` result) and try to send an `ErrorMessage` with that info
into the provided `errorChannel`.
Otherwise re-throw it as as

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

* * Apply review language-specific changes
2021-01-08 11:29:59 -05:00
Artem Bilan
e561e86fc8 Fix FtpTestSupport for 421 error from server
We fail sporadically in some FTP tests against
embedded Mina FTP server.
Turns out there was not enough concurrent logins allowed
on the server instance.

* Change the `ConnectionConfig` for FTP server to allow `1024`
concurrent logins instead of `10` by default
2021-01-07 11:50:26 -05:00
Artem Bilan
d4bf66f582 Improve RotatingServersTests for race conditions
Related to https://build.spring.io/browse/INT-MASTERSPRING40-1314/

When we initialize a `CachingSessionFactory`, we may fail connecting
ot FTP server, but we realize that only when we call `super.getSession()`
from spied factory beans in the test configuration

* Move `super.getSession()` as a first call of the overridden method
and don't change the state of monitored variables when an exception
happens during FTP connection
2021-01-07 10:56:48 -05:00
Artem Bilan
e77d3393a4 GH-3452: Warn Publisher.onError in NullChannel (#3453)
* GH-3452: Warn Publisher.onError in NullChannel

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

The `NullChannel` can subscribe to the `Publisher` payload fully ignoring
the possible data according the `NullChannel` nature.
However an error thrown from the reactive stream processing is also ignored.

* Log WARN message from the `Subscriber.onError()` when `NullChannel`
subscribes to the `Publisher` produced to this channel.
* Mention the logic in the `NullChannel` docs; point to the
`ReactiveRequestHandlerAdvice` for further possible error handling in
the target application

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

* * Remove unused imports

* * Fix `PseudoTransactionalMessageSourceTests` for `LogAccessor`
from `NullChannel`
2021-01-05 15:08:30 -05:00
Artem Bilan
fa1ab223ae Special handle for void in the RSocketOutGateway
To avoid extra `Publisher` subscription work in the target
application "flatten" a returned empty `Flux` for the `void`
expected type into a `Mono.empty()` for automatic subscription
on the output channel
2020-12-22 13:27:11 -05:00
Artem Bilan
c38da2f4ee Subscribe to Publisher in the NullChannel (#3448)
* Subscribe to Publisher in the NullChannel

If a payload of the message in the flow is a `org.reactivestreams.Publisher`,
it must be subscribed somewhere downstream to initiate reactive processing.
The `NullChannel` just ignores the message altogether and therefore `Publisher`
is lost

* Check the payload of the message in the `NullChannel` for `Publisher` type
and subscribe to it
* Verify in the test and mention this logic in the docs

**Cherry-pick to 5.4.x**

* Apply suggestions from code review

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2020-12-22 12:20:12 -05:00
Artem Bilan
ad57c6187a Fix MessageSourceTest for the latest spring-kafka
Related to: https://github.com/spring-projects/spring-kafka/issues/1659
2020-12-21 17:31:45 -05:00
Olivier Hubaut
7e66509682 GH-3445: Fix JdbcLock for IllegalMonitorStateEx
Fixes https://github.com/spring-projects/spring-integration/issues/3445

The `JdbcLockRegistry` improperly unlock the delegate (a `ReentrantLock`)
in the case of `TransientDataAccessException` or a `TransactionTimedOutException` is thrown.
As this occurs in a while loop, the next time the delegate is unlocked,
it not longer as a owner thread and throws an `IllegalMonitorStateException`.

* Move `delegate.unlock()` outside the while loop in the `JdbcLock.unlock()` method
* Add `JdbcLockRegistryDelegateTests` for mocked `LockRepository` to add more coverage
for `JdbcLockRegistry` functionality

**Cherry-pick to 5.4.x, 5.3.x & 5.2.x**
2020-12-21 10:46:26 -05:00
Artem Bilan
2e20021beb Change Kotlin jvmTarget back to 1.8
It looks like Kotlin support in the IntelliJ IDEA
doesn't not carry the `jvmTarget = '11'` properly
and it still stick with `1.6` in the code editor

See more info in the SO: https://stackoverflow.com/questions/52888341/does-kotlin-support-java-11
2020-12-15 12:00:53 -05:00
Artem Bilan
38089f4c48 Add plugins.gradle.org repo to build script
To avoid the `401 from server: Unauthorized`
when we try to reach `https://repo.spring.io/plugins-release`
it is better to point to some more central repository with
no authentication requirements.
Most of the Gradle plugins are managed in the `https://plugins.gradle.org/m2`
repo, not Maven Central
2020-12-11 10:22:55 -05:00
Artem Bilan
3bf4fd687d More GH Actions goodies (#3441)
* More GH Actions goodies

* Add RabbitMQ, MongoDB & Redis services into GH actions
* Remove Travis

* * Add `distributionSha256Sum` into `gradle-wrapper.properties`
* Try `TERM: dumb` to see difference for Gradle output in GH action
* Add `-S` to see the reason of test failure

* * Try MQTT plugin for RabbitMQ image

* * Try `-i` for test failure in Gradle on Actions

* * Use `eclipse-mosquitto` image for MQTT on actions
* Fix `FtpServerOutboundTests` for the proper FTP file list
* Output file list for the failed session in the `RotatingServersTests`

* * Adjust SOUT in the test for Checkstyle

* * Make some change to `RotatingServersTests`.
Looks like the order for `@BeforeAll` methods is not determined
and we may start to interaction with FTP server which is not
started yet

* Fix SSL Handshake Test

- we already made this change for the NIO test, but the NET test is failing the same
  way - the cert failure switched to the server so the expected exception was not
  thrown on the client side. Due to JVM changes.

* * Fix SFTP tests for wrong host and auto-startup state
* Remove `-i` for Gradle in the GH Actions

* * Try `--no-parallel` for Gradle in the GH Actions

* * Try GH actions without Mosquitto

* * Try `cyrilix/rabbitmq-mqtt` for GH Actions

Co-authored-by: Gary Russell <grussell@pivotal.io>
2020-12-09 10:26:13 -05:00
Artem Bilan
45877ba9bc Initial for GitHub Actions 2020-12-08 13:26:47 -05:00
Artem Bilan
15c2d16866 GH-3438: Add Build from Source into CONTRIBUTING (#3440)
* GH-3438: Add Build from Source into CONTRIBUTING

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

It is not clear at the moment what Java version and what build system is used
in the project from the `CONTRIBUTING.adoc`

* Add `Build from Source` section into the `CONTRIBUTING.adoc`
* Point to the `CONTRIBUTING.adoc` from the top level `README.md`
* Fix the current Java version in the `README.md`
* Mention that `Squash commits` must be avoided for subsequent commits into the PR

* * Apply suggest change for docs result
* Change Travis config to use `oraclejdk11` which is minimal already for for the project
2020-12-07 15:04:50 -05:00
Artem Bilan
b9190c8a13 Fix dokka task for Java 15 JavaDoc style 2020-12-03 13:41:54 -05:00
Artem Bilan
32ba5effbf Fix JavaDocs build problems 2
* Use Java 15 API link for JavaDocs
* Use `/current` API link for all the required Spring dependencies
2020-12-03 12:39:36 -05:00
Artem Bilan
e653742c3d Fix JavaDocs build problems
* Replace self-closing `<hr/>` with plain `<hr>` in the `overview.html`;
add `lang="en"` to avoid warning
* Use Java 15 API link for JavaDocs
* Use `/current` API link for all the required Spring dependencies
2020-12-03 10:38:53 -05:00
Artem Bilan
bdb3ba8ebd Upgrade dependencies including Gradle
* Fix compatibility with upgraded dependencies
* Move `What's New` for `5.4` to `history`
* Add `XmlUnit` dependency since the latest AssertJ has deprecated its `isXmlEqualTo()`
* Remove `javax.annotation-api` and `apiguardian-api` as redundant dependencies
2020-12-02 17:20:46 -05:00
Artem Bilan
cf8591d700 Start version 5.5 2020-12-02 14:37:20 -05:00
Artem Bilan
4909f030a1 GH-3434: Optimize unlinkAvailable in Redis
Fixes https://github.com/spring-projects/spring-integration/issues/3434

Each `RedisLock` has their own `unlinkAvailable` property
therefore we try to `unlink` on every unlock call and also log a WARN
about unavailability of this command in Redis, plus exception

* Move `unlinkAvailable` property to the `RedisLockRegistry` level
to have a check only once on a first `unlock()` call
* Move the whole exception logging onto the DEBUG level, leaving the WARN
only with the `ex.getMessage()`
* Optimize logging the same way in the `RedisMessageStore`

Cherry-pick to `5.3.x & 5.2.x`
2020-12-01 14:50:51 -05:00
Artem Bilan
97e1692a36 Fix some Sonar smells 2020-11-30 12:00:59 -05:00
Artem Bilan
c12acb9ff8 Fix FluxMessCh for subscription race condition
Related to https://build.spring.io/browse/INT-MASTER-2240

Turns out the `doOnRequest()` is still not enough to be sure
that subscriber is accepted into the `Publisher`.
Probably because `doOnRequest()` maybe really asked for the
subscription by itself for some logic

* Use `Mono` with `repeatWhenEmpty()` until
`this.sink.currentSubscriberCount() > 0`
2020-11-25 15:22:46 -05:00
Artem Bilan
efcc01804c Some miscellaneous fixes
Related to https://build.spring.io/browse/INT-MASTERSPRING40-JOB1-1271

* Fix race condition with subscription in the `FluxMessageChannel`:
rely on the `doOnRequest()` to start producing from upstream publishers
* Remove `SourcePollingChannelAdapterTests` since
`Class.getDeclaredConstructor().newInstance()` doesn't rethrow an exception as is
but wrap it into the `InvocationTargetException`.
This is probably the main reason to deprecate a regular `Class.newInstance()`
* Use `LettuceConnectionFactory.setEagerInitialization(true)` in the `RedisAvailableRule`
to avoid possible dead lock with lazy init
* Adjust Redis tests for new `RedisAvailableRule` behavior
2020-11-25 12:13:33 -05:00
Artem Bilan
63bd3e4938 Some miscellaneous docs related fixed 2020-11-19 14:04:25 -05:00
Artem Bilan
a12306be45 Clean repositories in build script 2020-11-16 10:08:10 -05:00
Spring Buildmaster
d1d4a7edae [artifactory-release] Next development version 2020-11-11 19:47:07 +00:00
Spring Buildmaster
21fdd4e4a4 [artifactory-release] Release version 5.4.1 2020-11-11 19:47:02 +00:00
Artem Bilan
b11bb3aed3 Upgrade dependencies; prepare for release 2020-11-11 14:23:23 -05:00
Artem Bilan
7eb07344cc GH-3428: Make Kotlin dependency optional again
Fixes https://github.com/spring-projects/spring-integration/issues/3428

The Kotlin Gradle plugin starting with Kotlin `1.4` adds a standard
Kotlin lib into `compile` scope fully ignoring an `optional` variant.
See more info here: https://kotlinlang.org/docs/reference/using-gradle.html#dependency-on-the-standard-library

* Add `kotlin.stdlib.default.dependency=false` into `gradle.properties`
to rely only on the explicit dependency definitions in the project config
* Remove explicit Kotlin deps from test scope in the target modules since
it is declared globally for all the modules
* Fix author emails in the `publish-maven.gradle` to their VMware variants
* Remove usage of `org.jetbrains.annotations` in favor of `@Nullable`
from Spring Framework
2020-11-11 11:04:24 -05:00
Artem Bilan
6565b7cc43 Fix mngmt dependency for MetricsCaptor
The `IntegrationManagementConfigurer` is a `BeanPostProcessor`
so it must not have direct dependency injection for other beans.
In our case it is a `MetricsCaptor` injected from the
`IntegrationManagementConfiguration`

* Fix `IntegrationManagementConfiguration` and `IntegrationManagementConfigurer`
to rely on the `ObjectProvider<MetricsCaptor>` instead

Tested against latest Spring Boot

**Cherry-pick to `5.3.x` & `5.2.x`**
2020-11-10 16:00:57 -05:00
Artem Bilan
fce0fef98f GH-3425: Remove mngmt gauges from CtxClosedEvent
Fixes https://github.com/spring-projects/spring-integration/issues/3425

It turns out that `IntegrationManagementConfigurer.destroy()` is still too
late to remove `gauges` and Micrometer tries to gather them on application
context close, when many beans are already destroyed

* Catch `ContextClosedEvent` in the `IntegrationManagementConfigurer`
and removed `gauges` from there
* Remove `destroy()` impl since it is out of use already:
the `IntegrationManagementConfigurer` is not supposed to be in the
target application directly, so it looks safe to remove the `DisposableBean`
altogether

**Cherry-pick to `5.3.x` & `5.2.x`**
2020-11-10 15:16:39 -05:00
Artem Bilan
0331933c16 Rely on MProducerSupport.active for Flux (#3423)
* Rely on `MProducerSupport.active` for `Flux`

* Fix `MessageProducerSupport` to extract an `active` flag and set it before
`isRunning` - the `Flux` subscription relies on the `takeWhile()`
where in case of `autoStartup = false` we will never start consume because
it is set to `true` already after `doStart()`
* Refactor all the `MessageProducerSupport` implementation with similar
`active` state to use already one from the super class

**Cherry-pick to 5.3.x**

* * Remove `MessageProducerSupport.setActive()`
to not let to mutate it from the implementations
* Set `active` to `false` in the `destroy()`
* Clean up and fix typos in the affected `JmsMessageDrivenEndpoint`

* * Pull `active` flag down to the `AbstractEndpoint`
* Set `active = true` in the `start()` before calling `doStart()`
* Do same for `active = false` in the `stop()`
* Clean up `AbstractEndpoint` impls to not call `doStart/doStop` for nothing
* Refactor endpoints to rely on the `active` state from the `AbstractEndpoint`
not their own
2020-11-06 13:51:03 -05:00
Gary Russell
13807eeb38 GH-3418: Fix Poller Undeclared Checked Exceptions
Resolves https://github.com/spring-projects/spring-integration/issues/3418

`Class.newInstance()` can propagate checked exceptions that are not declared.

**cherry-pick/back-port to 5.3.x, 5.2.x, 4.3.x**
2020-11-02 11:37:40 -05:00
Spring Buildmaster
04f89f5421 [artifactory-release] Next development version 2020-10-28 21:15:24 +00:00
Spring Buildmaster
1b38a30410 [artifactory-release] Release version 5.4.0 2020-10-28 21:15:19 +00:00
Artem Bilan
ac6a0982e5 Fix deprecations from Spring's StringUtils
* Use `LogAccessor` in the `XmlValidatingMessageSelector`
2020-10-28 16:33:51 -04:00
Artem Bilan
0a2a82a2f3 Upgrade dependencies; prepare for release 2020-10-28 15:38:01 -04:00
Artem Bilan
2dc8702130 Add Docs for R2DBC Channel adapters 2020-10-28 14:47:02 -04:00
rohan mukesh
51ebf40a5f Add Docs for Redis Stream Channel adapters
* Fix JavaDoc for the `ReactiveRedisStreamMessageProducer.setExtractPayload()`
2020-10-28 13:43:15 -04:00
Artem Bilan
80d3c67847 * Add @NonNullApi to ZeroMQ packages 2020-10-26 16:11:44 -04:00
Artem Bilan
5221ac1740 Add Java DSL for R2DBC module (#3415)
* Add Java DSL for R2DBC module

* Add JavaDocs for R2DBC component setters
* Introduce a `R2dbcMessageSource.SelectCreator` to narrow
a `StatementMapper` API access from SpEL
* Add missed `package-info.java` into R2DBC packages
* Add `hamcrest-core` as test dependency into SI-R2DBC
since Awaitility doesn't work without it

* * Add `@NonNullApi` to R2DBC packages
2020-10-26 16:10:34 -04:00