Commit Graph

10434 Commits

Author SHA1 Message Date
Gary Russell
acdc25a172 Upgrade to spring-kafka 2.6.0 2020-08-04 12:14:16 -04:00
Gary Russell
0e2652fdf6 More Cron test fixes 2020-08-03 16:51:55 -04:00
Gary Russell
2356324e9b Fix for internal changes to CronTrigger 2020-08-03 16:30:27 -04:00
Artem Bilan
f26d4c0a5a Fix FtpServerOutboundTests race condition
The `ArrayList` cannot be used in the test-case for checking
its size because the property is not `volatile`: even if
content of the list is what we expect (test logs confirms that),
the non-`volatile` property doesn't give us an actual value

* Use `CopyOnWriteArrayList` for this concurrent test to
be sure that internal `array.length` reflects the reality
after each interaction with the list
2020-08-03 10:06:37 -04:00
Artem Bilan
a62d75f1f0 Fix Reactor Netty dependencies 2020-08-02 09:30:57 -04:00
Artem Bilan
78bb84d07b Disable WebFluxDslTests till Security fixes
Related to https://github.com/spring-projects/spring-security/issues/8881
2020-07-31 11:00:27 -04:00
Gary Russell
8cf6ff0462 AMQP: Support CorrelationData Message Headers
In preparation for https://github.com/spring-cloud/spring-cloud-stream-binder-rabbit/issues/303

Now that `CorrelationData` has a `Future<?>`, users might simply add
correlation data in a header and not receive confirm/return messages.

- No longer require channels for returns and confirms
- don't build the confirm message if there are no channels
- reduce the log level for no channels to DEBUG
- complete the user's future when a message is returned (async GW)

* Fix typo.
2020-07-31 10:00:18 -04:00
Artem Bilan
f5522949f3 WebFluxDslTests: wait for reply for 10 seconds 2020-07-31 09:59:09 -04:00
Artem Bilan
5e01ec1c9c Use SNAPSHOT for Reactor dependencies 2020-07-31 09:07:56 -04:00
Artem Bilan
7ce020dfa7 Upgrade Gradle and plugins 2020-07-30 16:01:31 -04:00
Artem Bilan
564617bff0 Fix id for section in mail.adoc 2020-07-30 14:15:26 -04:00
Artem Bilan
ea546c52d0 Fix compatibility with latest Spring AMQP (#3352)
* Fix compatibility with latest Spring AMQP

* * Fix typo in the `amqp.adoc`
2020-07-30 11:00:28 -04:00
Michel Jung
ba5c80aff0 Fix wording in meter descriptions
Related to https://github.com/spring-projects/spring-integration/pull/3349
2020-07-29 09:57:35 -04:00
Artem Bilan
f23f3ea63d 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 16:59:35 -04:00
Artem Bilan
818f5a5efe Synchronize list of events for FTP server tests 2020-07-27 09:59:24 -04:00
Artem Bilan
92410b942c Deprecate RMI module
* Remove tests from SI-RMI since the module is deprecated
* Mention such a deprecation in the docs
2020-07-24 11:03:39 -04:00
Artem Bilan
5ec71d4b4a Improve MessageKryoRegistrar for registrations 2020-07-22 13:36:17 -04:00
Artem Bilan
5e45b09cd5 Fix typo in KryoCodecTests 2020-07-22 12:33:24 -04:00
Artem Bilan
6a02b5abe9 Improve Kryo Codec for registrations 2020-07-22 12:07:05 -04:00
Artem Bilan
064cb57ac0 Fix new Sonar smells 2020-07-22 11:32:53 -04:00
Artem Bilan
21dcdbce6d Upgrade to MongoDb driver 4.1.0-rc0 2020-07-22 11:28:13 -04:00
Artem Bilan
730c157064 Introduce ClientRSocketConnector.getRequester()
* Restore `Mono<RSocketRequester> getRSocketRequester()` on
`ClientRSocketConnector` and deprecate it in favor of newly introduced
`RSocketRequester getRequester()`: there is no need in wrapping a
`RSocketRequester` to deferred `Mono` since internal logic of the
`RSocketRequester` on client side is based on lazy-load API of the
`RSocketClient`
2020-07-22 10:25:47 -04:00
Artem Bilan
2c42c9181d Direct access to requester from ClientRSConnector
Since `RSocketRequester` is now lazy load on client side
there is no need to wrap it into a `Mono`.

* Change `getRSocketRequester()` to a plain getter

If there is a requirement to force connect to the server for receiving
requests from there, the `ClientRSocketConnector.connect()` should be used
2020-07-22 09:24:05 -04:00
Artem Bilan
ff44382d94 Use RSocketRequester.rsocketClient() to connect
Related to https://github.com/spring-projects/spring-framework/issues/25332

* Delegate subscription (and therefore auto-connection) into underlying `RSocketClient`
in the `ClientRSocketConnector`
2020-07-22 08:59:00 -04:00
Gary Russell
40b0031e0f GH-3340: IntegrationEvents - add getSourceAsType()
Resolves https://github.com/spring-projects/spring-integration/issues/3340

- add common super-interface for MQTT components
- add `getConnectionInfo()` so users can examine server URIs etc

* Reinstate per-adapter URIs - support multiple

* Restore single URL per adapter.

* Code cleanup for previous commit.
2020-07-21 16:29:23 -04:00
Artem Bilan
5be0ed17eb Fix some Sonar smells 2020-07-21 10:45:45 -04:00
Artem Bilan
c278d91a4b 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**
2020-07-21 10:09:08 -04:00
Artem Bilan
492f0bfee3 GH-3334: Add "embedded reaper" into CorrelationMH (#3342)
* GH-3334: Add "embedded reaper" into CorrelationMH

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

* Add `expireTimeout` property into `AbstractCorrelatingMessageHandler`
to call newly introduced `purgeOrphanedGroups()` API for removing old
groups from the store
* Add `expireDuration` to perform `purgeOrphanedGroups()` task periodically

* * Add Java DSL and XML support for `expireTimeout` and `expireDuration` options
* Document the new feature

* * Fix language in docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2020-07-20 16:31:24 -04:00
Artem Bilan
6a865b55b9 GH-3344: Treat kotlin.Unit return as null in MMIH (#3346)
* GH-3344: Treat kotlin.Unit return as null in MMIH

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

When function lambda doesn't return anything (e.g. a `void` method call is the last one),
Kotlin produces a `kotlin.Unit` instance as a return value which is not null and produced
as a reply message payload.

* Fix `MessagingMethodInvokerHelper` to treat a `kotlin.Unit` as `null` for reply
making Kotlin lambdas working the same way as Java lambdas when we don't return anything
from from there

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

* * Introduce `ClassUtils.isKotlinUnit(Class)` API;
use it in the `MessagingMethodInvokerHelper` instead of
`.getName().equals()`

* * Fix since on new `isKotlinUnit()` API
2020-07-20 13:51:54 -04:00
Artem Bilan
44a4523586 Fix new Sonar smells 2020-07-20 11:05:23 -04:00
Gary Russell
8d3d871996 GH-3343: Fluent API for CharacterStreamWritingMH
Resolves https://github.com/spring-projects/spring-integration/issues/3343
2020-07-17 11:27:32 -04:00
Artem Bilan
ebec500abd Upgrade dependencies to the latest snapshots
* Fix HTTP & WebFlux for a new CORS logic when `*` pattern
is used together with `allowCredentials`
* Fix RSocket module for deprecated API in SF
* The deprecated RMI API is left for the upcoming changes
2020-07-17 11:26:40 -04:00
Artem Bilan
8b16aede89 Fix new Sonar smells 2020-07-16 11:36:04 -04:00
Artem Bilan
b3111414fb Fix Checkstyle violation about import order 2020-07-15 13:29:46 -04:00
Alexandre Strubel
e4611d97a1 JDBC Lock acquire optimization
Thanks to the pair of `CLIENT_ID`/`CREATED_DATE`,
it is possible to know if the lock is expired, already held or can be reacquire.
I think that the pre delete row is unnecessary and redundant with these two columns.
The rows doesn't need to be purged because the number of row in the table is finite and equal to the number of locks.
At worst, the table will be able to be purged by `deleteExpired()`.

I propose to overwrite these two columns at acquire lock time instead of pre delete the row.
So `delete` then `update` or `insert` become `update` or `insert`.

One client held a lock.
- Another client will be able to hold the same lock only if:
1. the row doesn't exist. Done when the first client will call `unlock()`.
2. the lock expire in case of hardware shutdown. Done by "`OR CREATED_DATE<?`" in `updateQuery`.
- The same client will be able to reacquire it only if:
1. the row doesn't exist.
2. the lock is already held by him. Done by "`CLIENT_ID=? OR`" in `updateQuery`.

**Cost with PostgreSQL:**
```
EXPLAIN DELETE FROM INT_LOCK WHERE REGION='DEFAULT' AND LOCK_KEY='FOO' AND CREATED_DATE<'2020-07-14';
Delete on int_lock  (cost=0.14..8.17 rows=1 width=6)
  ->  Index Scan using int_lock_pk on int_lock  (cost=0.14..8.17 rows=1 width=6)
        Index Cond: (((region)::text = 'DEFAULT'::text) AND (lock_key = 'FOO'::bpchar))
        Filter: (created_date < '2020-07-14 00:00:00'::timestamp without time zone)

EXPLAIN UPDATE INT_LOCK SET CREATED_DATE='2020-07-15' WHERE REGION='DEFAULT' AND LOCK_KEY='FOO' AND CLIENT_ID=NULL;
Update on int_lock  (cost=0.00..11.40 rows=1 width=520)
  ->  Result  (cost=0.00..11.40 rows=1 width=520)
        One-Time Filter: false
        ->  Seq Scan on int_lock  (cost=0.00..11.40 rows=1 width=520)
```
```
EXPLAIN UPDATE INT_LOCK SET CLIENT_ID=NULL, CREATED_DATE='2020-07-15' WHERE REGION='DEFAULT' AND LOCK_KEY='FOO' AND (CLIENT_ID=NULL OR CREATED_DATE<'2020-07-14')
Update on int_lock  (cost=0.14..8.17 rows=1 width=372)
  ->  Index Scan using int_lock_pk on int_lock  (cost=0.14..8.17 rows=1 width=372)
        Index Cond: (((region)::text = 'DEFAULT'::text) AND (lock_key = 'FOO'::bpchar))
        Filter: (created_date < '2020-07-14 00:00:00'::timestamp without time zone)
```
2020-07-15 13:21:08 -04:00
Gary Russell
9c252be028 Fix Kafka Send Timeout
Resolves https://github.com/spring-cloud/spring-cloud-stream-binder-kafka/issues/928

Kafka has a longer default send timeout; this means a send could be successful long
after Spring has timed out the send.

**I will backport to the 3.3.x extension after merge**

* Use setSendTimeout; make it final.
2020-07-15 10:35:33 -04:00
Artem Bilan
a19e37237b Fix new and some old Sonar smells 2020-07-14 10:49:28 -04:00
Jay Bryant
df1f260a59 Wording changes
Replacing some terms
2020-07-13 16:31:03 -04:00
Artem Bilan
6e11d4cdf9 Fix new and some old Sonar smells 2020-07-13 14:07:07 -04:00
Gary Russell
9223613ee1 ConsumerRecord Logging Metadata Option 2020-07-10 15:14:49 -04:00
rohanmukesh12
eb3c6a017f INT-4566: Introduce R2DBC Inbound Channel Adapter
JIRA: https://jira.spring.io/browse/INT-4566

* Some code clean up
2020-07-08 15:26:38 -04:00
Artem Bilan
7a09358582 SO-62761903: Inject BF into Gateway's correlator
Related to https://stackoverflow.com/questions/62761903/spring-integration-reactive-streams-support-exception-in-creating-a-reactive

The `MessagingGatewaySupport` creates an internal endpoint
for consuming messages from the provided `replyChannel`.
The endpoint type depends on the channel type.
The `ReactiveStreamsConsumer` was missing a `BeanFactory` injection
causing an error when `ReactiveStreamsConsumer` tries to extract a default `ErrorHandler`
from `BeanFactory`

* Refactor `MessagingGatewaySupport` to inject a `BeanFactory` to all
the possible correlator endpoints.
Also always call `afterPropertiesSet()` for all of them

**Cherry-pick to 5.3.x & 5.2.x**
2020-07-08 14:58:38 -04:00
Gary Russell
b45d690a45 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**
2020-07-08 14:19:57 -04:00
Artem Bilan
0f7f0845f4 Remove overrides from IntegrationFlowDefinition
Since we don't need a backward bytecode compatibility since this version,
we don't need methods override in the `IntegrationFlowDefinition` any more
2020-07-08 12:51:00 -04:00
Artem Bilan
16803beaab GH-3321: Add version section into bug_report.md
Fixes https://github.com/spring-projects/spring-integration/issues/3321
2020-07-07 13:09:34 -04:00
Gary Russell
e919428680 GH-3326: TCP: Support Unsolicited Server Messages
Resolves https://github.com/spring-projects/spring-integration/issues/3326

- OB Gateway - send unsolicited messages and late replies to a channel
- Support multiple `TcpSender` s

* Add channel variant to spec; code polishing
2020-07-06 15:05:57 -04:00
Alexandre Strubel
e2c6e77f2f GH-3272: Add lease renewal for distributed locks
Fixes https://github.com/spring-projects/spring-integration/issues/3272

* Introduce a `RenewableLockRegistry` since not all `LockRegistry` implementations
provide a way to renew the lease for the lock
* Implement `RenewableLockRegistry` in the `JdbcLockRegistry`
* Test and document the feature
2020-07-06 12:46:47 -04:00
Artem Bilan
381a071287 Clean up RedisLockRegistryLeaderInitiatorTests
Related to https://build.spring.io/browse/INT-MASTERSPRING40-1129

When there is no other candidates in the cluster, the current `yield()`
will give a leadership to the current active initiator back
Therefore a `revoke()` might not be called at all

* Fir the `RedisLockRegistryLeaderInitiatorTests` to check revoking
after `stop()` instead of `yield()`
2020-07-06 11:30:43 -04:00
Alexander Shaklein
7424cb215c GH-3324. fix NPE in StdIntFlowContext
Fixes https://github.com/spring-projects/spring-integration/issues/3324

The `StandardIntegrationFlowContext.remove()` has a possible NPE 

**Cherry-pick to 5.3.x & 5.2.x**
2020-07-04 15:58:49 -04:00
Artem Bilan
146b0af1f4 GH-3320: Refine lifecycle control in StdIntFlow (#3322)
* GH-3320: Refine lifecycle control in StdIntFlow

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

Turns out that lifecycle control for the whole bunch of components
in one `IntegrationFlow` is useful in fields.

* Change the logic in the `StandardIntegrationFlow` to let to call
`start()` and `stop()` independently how the flow was registered in
the application context.
This way it can be autowired as a `Lifecycle` to let end-user to
avoid the search for proper component in the flow to stop or start
manually - all the components registered with the flow are going
to be stopped or started respectively

* * Add `this.` to class property usage to satisfy Checkstyle

Co-authored-by: Artem Bilan <abilan@vmware.com>
2020-07-02 15:29:43 -04:00