Commit Graph

11401 Commits

Author SHA1 Message Date
abilan
a9285c3c2c Use assertj dep for test scope explicitly
Looks like something is overriding `assertj-core` version from `3.24.2 -> 3.11.1`
which doesn't have an API we use.

* Adding `testImplementation "org.assertj:assertj-core:$assertjVersion"` explicitly
instead of transitive from the `spring-integration-test-support` fixes the problem
2023-06-22 17:11:56 -04:00
abilan
197a58af5d Use debezium-bom 2023-06-22 16:07:17 -04:00
abilan
34904b3cd6 Upgrade to commons-io-2.13.0; downgrade sshd-sftp
* The latest `sshd-sftp-2.10.0` has a bug not removing trailing `.`
in the "unrooted" path when we ask to create a remote directory.
It works on Windows well, but fails on UNIX file systems.
* The `commons-io-2.13.0` has `Tailer` ctors deprecated
and exposes a builder API.
It starts a tailer process though unconditionally in
its own thread.
Use `setStartThread(false)` to have the tailer process
managed by our own `TaskExecutor`
* Add `ApacheCommonsFileTailingMessageProducer.setPollingDelayDuration(Duration)`
* Deprecate a `TailerListener` impl on the `ApacheCommonsFileTailingMessageProducer`
in favor of an internal instance
2023-06-22 15:41:38 -04:00
abilan
03799293ce Add @LogLevels for SftpRemoteFileTemplateTests
Not clear why `SftpRemoteFileTemplateTests.testINT3412AppendStatRmdir()`
 is failing on CI Linux, so add a tracing diagnostics to see how Apache SSHD behaves over there
2023-06-22 11:55:38 -04:00
abilan
6ded64c0cd Remove org.asciidoctor.jvm.gems plugin
Looks like we don't use any GEMs in out docs: generated PDF and HTML look OK
2023-06-22 10:55:18 -04:00
abilan
9882ce8542 Remove repo.spring.io/plugins-release from Gradle
The https://repo.spring.io/plugins-release requires an authentication now.
Replace it with a `mavenCentral()`
2023-06-22 10:29:45 -04:00
abilan
8a7293c680 An attempt to fix Sftp tests to new sshd-sftp 2023-06-22 10:19:46 -04:00
abilan
8abd72d7c0 Upgrade dependencies; fix problems
* Mockito doesn't allow to `spy()` mocks any more or "overspy"
* Deprecate `KotlinScriptExecutor` if favor of fully supported JSR223
service loaded via `DefaultScriptExecutor`
* Use only one `kotlin-scripting-jsr223` dependency
2023-06-21 17:39:55 -04:00
abilan
a147040072 Some synchronized comments clean up 2023-06-21 13:54:23 -04:00
Christian Tzolov
c38ed96ee9 GH-8643: Replace synchronized with Lock
Fixes https://github.com/spring-projects/spring-integration/issues/8643

* First pass - trivial synchronized blocks
  - Convert the "trivial" `synchronized` block into `ReentrantLock`.

* fix checkstyle

* use blocking lock

* Secon pass - handle multi-lock cases

* javadoc + year

* addres first batch of review suggestions

* fix checkstyle issues

* fix the mqtt parent/child lock monitor sharing

* fix the mqtt parent/child lock monitor sharing, v2

* patch the stomp test
2023-06-21 13:25:45 -04:00
Artem Bilan
9e9bfd0c5c Remove ThreadLocal from RequestHandlerRetryAdvice (#8650)
Related to https://github.com/spring-projects/spring-integration/issues/8644

With virtual threads it is recommended to stay away from `ThreadLocal`
variables to avoid memory exhausting with too many virtual threads

* Fix `RequestHandlerRetryAdvice` to transfer the message context via internal
`IntegrationRetryCallback` implementation.
* Cast to this `IntegrationRetryCallback` in a newly introduced internal `IntegrationRetryListener`
to extract `messageToTry` and set it into a `RetryContext`
`ErrorMessageUtils.FAILED_MESSAGE_CONTEXT_KEY` attribute
* Deprecate a usage of an external `RetryListener` implementation of the `RequestHandlerRetryAdvice`
2023-06-21 11:41:01 -04:00
Vladislav Fefelov
8a29c1e60b Optimise maybeIndex() in JsonPropertyAccessor
The `NumberFormatException` flow control is costly
operation

* Use `Character.isDigit()` check iterating through property String
instead of `NumberFormatException` flow control

**Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**
2023-06-16 13:43:28 -04:00
abilan
8315b11494 Some tweaks for ImapMailReceiverTests 2023-06-15 13:10:51 -04:00
abilan
656281e74a Use MySQLContainer for Debezium Testcontainer 2023-06-15 11:58:33 -04:00
abilan
99122d7621 Diagnostic: Add LogLevels to ImapMailReceiverTest
* Fix `com.sun.mail` to `jakarta.mail` in Mail module `log4j2-test.xml`
2023-06-15 10:54:37 -04:00
abilan
66e935f92e Fix graphql.adoc and optimize Debezium tests
* Fix some typos and update to the actual types in the `graphql.adoc`
* Don't use `@Container` in the `DebeziumMySqlTestContainer`,
but rather start it manually in the `@BeforeAll` and let one container
to survive between tests.
The Ryuk container then takes care about other containers on JVM exist
2023-06-14 14:13:18 -04:00
Artem Bilan
4db9bad50d GH-8642: Revise executors in the project (#8647)
* GH-8642: Revise executors in the project

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

* Rework some `Executors.newSingleThreadExecutor()` to `ExecutorServiceAdapter(new SimpleAsyncTaskExecutor())`
* Expose `TaskExecutor` setters; deprecate `ExecutorService`-based
* Some other code clean up in the effected classes: `LogAccessor`, no `synchronized` in critical blocks
* Give a meaningful prefix for default threads in the context of components, e.g. `SubscribableRedisChannel` - `getBeanName() + "-"`

* * Fix `PostgresChannelMessageTableSubscriberTests` for
`PostgresSubscribableChannel` initialization to let it create
its internal `Executor`

* Use an `AsyncTaskExecutor` injection instead of `ExecutorServiceAdapter` wrapping

* Fix `LockRegistryLeaderInitiatorTests` for `taskExecutor` injection

* Bring back `LockRegistryLeaderInitiator.setExecutorService()`
as an accident after property auto-renaming
2023-06-14 13:33:46 -04:00
Christian Tzolov
aac2adbaa3 Upgrade debezium to 2.3.0.RC1 2023-06-14 09:23:08 -04:00
Artem Bilan
a862692546 Executor instead of ThreadFactory for DebeziumMP
Related to https://github.com/spring-projects/spring-integration/issues/8642

For consistency with other Spring requirements and realignment with virtual threads,
it is better to require a `TaskExecutor` injection instead of `ThreadFactory`

* Fix `DebeziumMessageProducer` to rely on a `TaskExecutor` API instead of `ThreadFactory`
and `ExecutorService`

* * Remove unused import from the `DebeziumMessageProducerSpec`
2023-06-13 16:06:37 -04:00
abilan
b5767483e1 Improve Delayer docs around messageGroupId
* Mention in the Javadocs of the `DelayHandler`, `DelayerEndpointSpec`,
`BaseIntegrationFlowDefinition.delay()`, `GroovyIntegrationFlowDefinition.delay()`,
`KotlinIntegrationFlowDefinition.delay()` that `messageGroupId` is required option
* Explain in the docs why `messageGroupId` is required and why it cannot rely on a bean name
2023-06-13 10:59:06 -04:00
Artem Bilan
81af20aabf Improve Delayer DSL (#8645)
* Improve Delayer DSL

Move `groupId` option from a `delay()` method arg to the `DelayerEndpointSpec`
to make it cleaner from code reading perspective
* Expose new DSL method based on just a `DelayerEndpointSpec` for Kotlin &v Groovy
* Deprecate multi-arg `delay()` methods in favor of `Consumer<DelayerEndpointSpec>`-based

* * Fix language and code style
2023-06-12 16:01:40 -04:00
Gary Russell
c4ee5512f6 GH-8638: Kafka: Send All Fails to Failure Channel
Resolves https://github.com/spring-projects/spring-integration/issues/8638

Previously, immediate failures (e.g. timeout getting metadata) were
only thrown as exceptions, and not sent to the failure channel, if present.

**cherry-pick to all supported branches**
2023-06-08 13:44:29 -04:00
abilan
95f1eb8c28 GH-8616: Upgrade to Angus Mail to 2.0.2
Fixes https://github.com/spring-projects/spring-integration/issues/8616

* And Greenmail to `2.1.0`
2023-06-08 13:42:16 -04:00
abilan
9752229cd1 Use UUID in Debezium tests for unique ids 2023-06-08 12:30:13 -04:00
Artem Bilan
33f0b8ec4a Optimize synchronized in PartitionedDispatcher (#8640)
Even if the `PartitionedDispatcher.populatedPartitions()`
is fast, in-memory, non-blocking operation, its active call from the `dispatch()`
on every message sent to the channel may pin the virtual thread.

* Optimize the `populatedPartitions()` for double `if`
where we will step into a `synchronized` block only for first several concurrent messages

**Cherry-pick to `6.1.x`**
2023-06-08 11:23:09 -04:00
Artem Bilan
8b8a7a4c16 Fix DSL for inner bean names generation (#8639)
The `IntegrationFlowBeanPostProcessor.processIntegrationComponentSpec()`
uses a wrong `generateBeanName()` for component to register making the
provided `id` as a prefix

* Use `generateBeanName(Object instance, String prefix, @Nullable String fallbackId, boolean useFlowIdAsPrefix)`
instead to properly "fallback" to the provided name

**Cherry-pick to `6.1.x`**
2023-06-08 09:50:32 -04:00
abilan
79408d7b2c Fix observation race condition in WebFlux test
There is a race condition when we already have a reply,
but the span in the last channel is not closed yet.
2023-06-07 19:10:47 -04:00
abilan
7655d97cee Fix code typos in filter.adoc & router.adoc
* Fix race condition in the `JdbcPollingChannelAdapterParserTests`
making SELECT and UPDATE as a part of the same transaction
* Remove `inProcess = JAVA_EXEC` from ASCIIDoc Gradle tasks in attempt
to make them working in parallel
2023-06-07 15:19:03 -04:00
abilan
0cf81dbbbd Fix WebFluxObservationPropagationTests for HTTP
The `WebTestClient` was previously binding directly to the web layer (no HTTP layer involved).
Because the new instrumentation is done at the HTTP level
(it's required to fully capture error handling and more),
 the test client must bind at the HTTP level with a `Connector`.
2023-06-07 14:12:38 -04:00
abilan
e9f7780e84 Fix race condition in DebeziumMessProducerTests
The `then(debeziumEngineMock).should().run()` cannot be just checked
after `debeziumMessageProducer.start()`: the `DebeziumEngine` is really
started on a separate thread.

* Check for a `run()` interaction with the mock already after calling
`debeziumMessageProducer.stop()`.
The `stop()` waits for an internal `latch` which is fulfilled when
`DebeziumEngine` exists from its `run()` cycle
* Rename `DebeziumMessageProducer.latch` to `lifecycleLatch` to give it
more sense.
2023-06-07 13:55:11 -04:00
abilan
c24d10c8ae Fix deprecations in test from SF
Related to https://github.com/spring-projects/spring-framework/issues/30013

The `WebHttpHandlerBuilder` customization with an `ObservationRegistry`
doesn't add a `SERVER` trace as it was with deprecated `ServerHttpObservationFilter`
2023-06-07 13:12:51 -04:00
abilan
cc113e1eed Fix IntegrationFlowAdapter sample in docs
Java DSL has been improved since the last time this sample
has been added into docs
2023-06-06 10:12:51 -04:00
Christian Tzolov
c9023d114b GH-8632: Add DSL for Debezium module
Fixes https://github.com/spring-projects/spring-integration/issues/8632

* Debezium DSL initial support
* additional dsl debezium factory
* debezium dsl improvements and tests
* impove debezium docs and streamline dsl testing
* docs clarifications
* fix doc cross-reference
* updgrade debezium to 2.2.1.Final. Clean docs
* fix multiflow config tests
* improve batch tests
* Code and doc formatting
* Make `name` Debezium property as random according to its docs:
```
Unique name for the connector.
Attempting to register again with the same name fails.
This property is required by all Kafka Connect connectors.
```
* Code style clean up
2023-06-02 11:07:22 -04:00
abilan
1ebfb55322 Upgrade SonarQube plugin to 4.2.0.3129 2023-06-01 12:20:18 -04:00
Artem Bilan
e01d0a9cd0 Introduce HeaderFilterSpec to streamline DSL API (#8636)
* Introduce HeaderFilterSpec to streamline DSL API

The concern has been driven by the discussion from: https://github.com/spring-projects/spring-integration/issues/8625
The point is that Java method arguments are not so descriptive when we read the code.
Therefore, it is better to design DSL the way it would be cleaner from reading perspective.
Plus less choice of methods to chain would give a better end-user experience from coding.

* Add a `HeaderFilterSpec` which can accept `headersToRemove` and `patternMatch` as individual
options instead of top-level deprecated `headerFilter(headersToRemove, patternMatch)` `IntegrationFlow` method.
This way Kotlin and Groovy DSLs get a gain from their "inner section" style.
* Such a `Consumer<HeaderFilterSpec>` way to configure an endpoint is similar to already
existing `aggregate(Consumer<AggregatorSpec>)`, `resequence(Consumer<ResequencerSpec>)` etc.
In other words those components which has a dedicated `ConsumerEndpointSpec` extension are OK
from an idiomatic DSL style perspective
* Expose a `HeaderFilter.setHeadersToRemove()` to make it working smoothly with this new
DSL requirements
* Apply a new `headerFilter()` style into Kotlin and Groovy DSLs

This is just an initial work to surface an idea.
If it is OK, I'll slow continue with others to realign and simplify the paradox of choice.

* * Fix asterisk imports in the `KotlinIntegrationFlowDefinition`
2023-06-01 12:18:02 -04:00
Christian Tzolov
8b004e9ec2 GH-3779: Add Debezium Channel Adapter
Fixes https://github.com/spring-projects/spring-integration/issues/3779

initial debezium doc
address some reviews
resolve some classpath conflicts
hacking failed test
fixing tests and dependecies
address review comments
improve test coverage
fix test checkstyle
remove kafak references. hit support for batch
improve java doc
Initial batch support

 Convert the list of Change events into list of Messages.
 Use the same rules for buidling messages as the non-batch mode.

Refine batch implementation and tests
harden the testcontainers start/stop lifecycle
simplify batch mode
adjust test log config
clean gradle config
Add  `HeaderMapper` filter configuration. Fix JavaDocs
Use `CustomizableThreadFactory` for Exec Service. IT header tests
more debeizum documentation
Remove external Executor support in favor of configurable ThreadFactory
minor `Threadfactory` naming fix
fix support package structure
* Clean up code style and language typos
2023-05-23 16:50:16 -04:00
abilan
36930f525a Upgrade Kotlin Coroutines to '1.7.1' 2023-05-22 17:22:49 -04:00
Artem Bilan
32e34bf2ec GH-5871: Add missed order attr to XSDs (#8624)
* GH-5871: Add missed `order` attr to XSDs

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

* * Fix `spring-integration-xml.xsd` for duplicates
2023-05-22 11:59:47 -04:00
Artem Bilan
c70d7a6688 GH-8625: Add Duration support for <poller> (#8627)
* GH-8625: Add Duration support for `<poller>`

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

The duration can be represented in a ISO 8601 format, e.g. `PT10S`, `P1D` etc.
The `<poller>` and `@Poller` don't support such a format.

* Introduce a `PeriodicTriggerFactoryBean` to accept string values for
trigger options and parse them manually before creating the target `PeriodicTrigger`
* Use this `PeriodicTriggerFactoryBean` in the `PollerParser` and `AbstractMethodAnnotationPostProcessor`
where we parse options for the `PeriodicTrigger`
* Modify tests to ensure that feature works
* Document the duration option
* Add more cross-links into polling docs
* Fix typos in the affected doc files
* Add `-parameters` for compiler options since SF 6.1 does not support `-debug` anymore
for method parameter names discovery

* Fix typos

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

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-22 11:47:08 -04:00
Artem Bilan
ba417de680 Remove deprecations from previous versions (#8628) 2023-05-22 11:19:13 -04:00
abilan
edbaf6d590 Start version 6.2.0
* Add Christian Tzolov to author name in the doc
* Move `whats-new.adoc` content to new `changes-6.0-6.1.adoc`
* Upgrade to Gradle `8.1.1`
* Upgrade to Spring Framework `6.1`
* Fix `StompSessionManagerTests` for deprecated `ConcurrentTaskScheduler` ctor
* Fix XML configs for Kafka to use types for ctor args instead of their names.
Apparently SF doesn't do a discovery by names anymore.
2023-05-16 20:40:11 -04:00
Spring Builds
6433445ee7 [artifactory-release] Next development version 2023-05-16 20:34:40 +00:00
Spring Builds
96c7f3034d [artifactory-release] Release version 6.1.0 2023-05-16 20:34:37 +00:00
abilan
af4c7d2ad4 Bring back sshd-sftp-2.9.2
Looks like there is some bug in the latest version,
so the directory cannot be created on Linux

We will revise the problem in the next version
2023-05-16 15:38:04 -04:00
abilan
a937d5ff6c Add diagnostics to SftpRemoteFileTemplateTests 2023-05-16 15:10:29 -04:00
abilan
e70d0ef5e2 Upgrade dependencies; prepare for release
* `--add-opens` for `java.lang` and `java.util`
in Groovy and Scripting modules to let `java.util.Date` scoped prototype bean
to work back with new CGLIB classpath limitations
2023-05-16 13:17:22 -04:00
abilan
3618965491 GH-8623: DefLockRepository: back to LocalDateTime
Fixes https://github.com/spring-projects/spring-integration/issues/8623

Turns out not all JDBC drivers (or RDBMS vendors) support `java.time.Instant`
mapping to their `TIMESTAMP` type.
For example the PostgreSQL fails like:
```
org.postgresql.util.PSQLException: Can't infer the SQL type to use for an instance of java.time.Instant.
```

* Use `LocalDateTime.now(ZoneOffset.UTC)` instead `Instant.now()`.
Essentially bringing back the behavior from the previous version
2023-05-16 11:00:14 -04:00
Artem Bilan
191f693377 Fix memory leak in the FluxMessageChannel (#8622)
The `FluxMessageChannel` can subscribe to any volatile `Publisher`.
For example, we can call Reactor Kafka `Sender.send()` for
input data and pass its result to the `FluxMessageChannel`
for on demand subscription.
These publishers are subscribed in the `FluxMessageChannel`
and their `Disposable` is stored in the internal `Disposable.Composite`
which currently only cleared on `destroy()`

* Extract `Disposable` from those internal `subscribe()` calls
into an `AtomicReference`.
* Use this `AtomicReference` in the `doOnTerminate()`
to remove from the `Disposable.Composite` and `dispose()`
when such a volatile `Publisher` is completed

**Cherry-pick to `6.0.x` & `5.5.x`**
2023-05-15 16:28:29 -04:00
Artem Bilan
3c0927e4ac GH-8585: Add Javadocs to Pollers & PollerFactory (#8621)
* GH-8585: Add Javadocs to Pollers & PollerFactory

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

* * Fix Javadoc tags order

* * One more Javadoc tags order
2023-05-15 12:50:46 -04:00
Artem Bilan
396f5fb87b GH-8014: Improve doc for Service Activator (#8619)
* GH-8014: Improve doc for Service Activator

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

* Fix language in Docs

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

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-05-15 12:30:14 -04:00