Commit Graph

11445 Commits

Author SHA1 Message Date
Artem Bilan
7dcc0bb125 GH-8680: Check DB for table on start (#8690)
* GH-8680: Check DB for table on start

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

If database is not initialized properly before application start, we may lose messages
at runtime when we fail to insert data into DB

* Implement `SmartLifecycle` on `JdbcMessageStore`, `JdbcChannelMessageStore`,
`JdbcMetadataStore`, and `DefaultLockRepository` to perform `SELECT COUNT` query in `start()`
to fail fast if no required table is present.
* Refactor `AbstractJdbcChannelMessageStoreTests` into JUnit 5 and use `MySqlContainerTest`
for more coverage
* Fix newly failed tests which had DB not initialized before
* Exclude `commons-logging` from `commons-dbcp2` dependency to avoid
classpath conflict
* Document the new feature

* * Fix HTTP URL in the `DataSource-mysql-context.xml`

* Fix language in docs

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

* * Add `setCheckDatabaseOnStart(false)` to disable the check query for all the SI JDBC components

* Fix language in Javadocs

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

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-07-28 14:47:49 -04:00
abilan
0c7d40d1e2 Fix EnricherSpec for method choice ambiguity 2023-07-28 12:33:55 -04:00
abilan
b6fe685873 Fix some Kotlin <-> Java DSL interoperability
* Remove generic argument from the `EnricherSpec.property()` which simply does nothing, but noise
- `Object` is enough
* Do the same for `EnricherSpec.header()`
* Fix `KotlinEnricherSpec`, respectively: no generic argument - just `Any`
* Make `KotlinIntegrationFlowDefinition.route()` to expect non-null for `router` arg
* Add `& Any` to generic params of the `KotlinRouterSpec` methods - according compiler warning requirements
2023-07-28 11:54:59 -04:00
abilan
abcc115c21 Upgrade to Gradle 8.2.1 2023-07-27 17:16:20 -04:00
Artem Bilan
b6d39e429b GH-3696: DeserializationEx support for KafkaMS (#8689)
* GH-3696: DeserializationEx support for KafkaMS

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

* Add an internal logic into `KafkaMessageSource` to react properly for the
`ErrorHandlingDeserializer` configuration and re-throw `DeserializationException`

* * Use `ErrorHandlingUtils` from `spring-kafka` to determine a `deserializer` from consumer properties

* Revise the test in favor of just single `await().untilAsserted()` -
no reason to wait for assignment or check for returned record.
We just need to be sure that `DeserializationException` is thrown eventually
2023-07-26 16:19:44 -04:00
abilan
2efaecdf95 Remove Gitter badge from README
We don't support Gitter chat anymore.
Everyone is advised to raise questions on StackOverflow
2023-07-26 15:53:32 -04:00
Eric Haag
53710fb804 Connect build to ge.spring.io
This change publishes a build scan to ge.spring.io for every local
build from an authenticated Spring committer and for CI where
appropriate access tokens are available. The build will not fail if
publishing fails.

This change also allows the build to benefit from remote build caching,
providing faster builds for all contributors.

Additionally, the project will have access to all features of Gradle
Enterprise such as:

- Dashboards to view all historical build scans, along with performance
   trends over time
- Build failure analytics for enhanced investigation and diagnosis of
   build failures
- Test failure analytics to better understand trends and causes around
   slow, failing, and flaky tests
2023-07-26 14:33:00 -04:00
ColoredCarrot
bd013e095c GH-8681: Expose send-buffer-overflow-strategy
Fixes https://github.com/spring-projects/spring-integration/issues/8681

* Expose `send-buffer-overflow-strategy` attribute for WebSocket XML configuration
* GH-8681: Add send-buffer-overflow-strategy to documentation
2023-07-24 11:03:50 -04:00
Artem Bilan
f4212d8df4 GH-8685: Re-fetch group after setting condition (#8686)
* GH-8685: Re-fetch group after setting condition

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

The `AbstractCorrelatingMessageHandler` updates the group metadata in DB
not only for provided `condition`, but also a `lastModified` field.
A subsequent scheduling for group timeout takes the `lastModified`
to compare with the value in the store after re-fetching group in task.
This does not reflect reality since adding `condition` modifies the data in DB,
but in-memory state remains the same.

* Re-fetch a group from the store in the `AbstractCorrelatingMessageHandler.setGroupConditionIfAny()`.
* Verify expected behavior via new `ConfigurableMongoDbMessageGroupStoreTests.groupIsForceReleaseAfterTimeoutWhenGroupConditionIsSet()`

**Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**

* * Fix Checkstyle violation in the test
2023-07-24 09:10:44 -04:00
abilan
4e464e9ce5 Try GH Actions on ubuntu22-8-32 2023-07-18 16:31:54 -04:00
abilan
5533bc86af Try upload-parallel: 10 for Maven deploy 2023-07-18 15:54:35 -04:00
abilan
79139915e8 Update GH workflows to the latest versions 2023-07-18 15:37:41 -04:00
Spring Builds
39304e399a [artifactory-release] Next development version 2023-07-18 18:47:45 +00:00
Spring Builds
9c298663bf [artifactory-release] Release version 6.2.0-M1 2023-07-18 18:47:42 +00:00
abilan
674a68def4 Upgrade to Spring Security 6.2.0 & GraphQL 1.2.2 2023-07-18 12:43:36 -04:00
Julian Koch
be53593af9 GH-8678: Add BufferOverflowStrategy for WebScoket
Within Spring Integration's WebSocket support, a `ConcurrentWebSocketSessionDecorator`,
which buffers outbound messages if sending is slow,
is used to decorate all websocket sessions in `IntegrationWebSocketContainer`,
the standard entrypoint for using websockets with Integration.

* Expose a `ConcurrentWebSocketSessionDecorator.OverflowStrategy` option on the `IntegrationWebSocketContainer`

**Cherry-pick to `5.5.x`, `6.0.x` & `6.1.x`**
2023-07-18 11:06:17 -04:00
abilan
790b8f999f Upgrade to the latest deps
* Fix `CamelMessageHandlerTests` for a new Apache Camel API
2023-07-17 16:20:09 -04:00
Artem Bilan
152666116a Upgrade to MINA SSHD 2.10.0 (#8676)
* Remove trailing slashes from remote dirs to create in SFTP tests
2023-07-17 16:19:06 -04:00
Artem Bilan
d4535cab7d GH-8674: Fix ServerKeyVerifier impl for key type (#8675)
Fixes https://github.com/spring-projects/spring-integration/issues/8674

The `ResourceKnownHostsServerKeyVerifier` does not take into account that several different
keys can be present in the known hosts resource for the same host/port

* Fix `ResourceKnownHostsServerKeyVerifier` to find a list of knows host for the requested session.
Then iterate of this result to match the key type first and then compare keys and their `revoked` marker

**Cherry-pick to `6.1.x` & `6.0.x`**
2023-07-17 14:26:39 -04:00
abilan
f527025256 Fix placeholder in JmsChannelParser for cache
Looks like spring JMS does not uppercase the `cacheLevelName` before assigning
anymore.

* Remove `toUpperCase()` for `cache` in the `JmsChannelParser` logic.
* Perform `toUpperCase()` in the `JmsChannelFactoryBean.setCacheLevelName()` instead
2023-07-17 11:07:24 -04:00
Artem Bilan
20d5f628bc GH-8644: WebSocketHandlerReg: Remove ThreadLocal (#8667)
Fixes https://github.com/spring-projects/spring-integration/issues/8644

* Introduce an inner `DynamicHandlerRegistrationProxy` class
to create an `IntegrationDynamicWebSocketHandlerRegistration`
and map it into a provided `WebSocketHandler` when a `dynamicHandlerMapping`
is in action.

Co-authored-by: pziobron <64628007+pziobron@users.noreply.github.com>
2023-07-13 10:47:00 -04:00
Gary Russell
fc3c8d2c8d GH-8668: AMQP Docs for Exclusive and S-A Consumers
Resolves https://github.com/spring-projects/spring-integration/issues/8668

**cherry-pick to all supported branches**
2023-07-12 16:50:03 -04:00
Artem Bilan
eb944335ac GH-8664: Do not use broken observeWithContext() (#8665)
Fixes https://github.com/spring-projects/spring-integration/issues/8664

When an `Observation` is turned to `NoopObservation`,
the `observeWithContext()` fails with `ClassCastException`
since `NoopObservation` serves just plain `Context` not the one we supplied

* Fix `MessagingGatewaySupport.sendAndReceiveWithObservation()` same way
as it is in version `6.0.x`
* Modify `IntegrationObservabilityZipkinTests` to reject some `Observation`
via `observationPredicate()` configuration

**Cherry-pick to `6.1.x`**
2023-07-12 14:51:24 -04:00
abilan
076b34dd6f Upgrade some dependencies to latest Milestones 2023-07-12 12:19:38 -04:00
Artem Bilan
e4c1851c07 Fix ImapIdleChA for scheduling race condition (#8670)
* Fix ImapIdleChA for scheduling race condition

The IMAP IDLE is long-lived process and can be blocked
waiting for any reply from the server.
This way it is not suited to be used in a `TaskScheduler`
especially when it has only one thread in its pool in Spring Boot by default.
Another concurrent scheduled task is exactly an `ImapMailReceiver.IdleCanceller`.
With a single thread in a `TaskScheduler` pool it cannot be reached
therefore we never cancel and IDLE task and cannot react to the connection loss properly

* Rework the `ImapIdleChannelAdapter` logic to use a regular `Executor` and `while()` loop
with a `Thread.sleep()` when we lose connection
* Clean up the `ImapMailReceiverTests` from `TaskScheduler` not used anymore.
* Expose new `taskExecutor` option in the `ImapIdleChannelAdapterSpec` for Java DSL
* Enable `ImapMailReceiverTests.testIdleWithMessageMapping()` with an attempt to see
if this fix covers an unclear problem exposed before

* * The `testIdleWithMessageMapping()` still fails on GH actions
2023-07-12 11:00:40 -04:00
Artem Bilan
9597b7addb GH-8563: Fix SFTP RENAME with unconditional DEL (#8671)
Fixes https://github.com/spring-projects/spring-integration/issues/8563

* Rework the `SftpSession.rename()` logic to be similar to what is there in the `FtpSession`, for example:
try to remove a remote target file before renaming.
* Fix `SftpSession.remove()` to check for `SftpConstants.SSH_FX_NO_SUCH_FILE` response status
to return `false`
2023-07-12 10:57:03 -04:00
abilan
c5f6c126e8 Upgrade to H2 2.2.220 2023-07-10 12:05:00 -04:00
Artem Bilan
72fc79dbd5 Fix Groovy DSL for new splitter style (#8669)
* Fix Groovy DSL for new splitter style

* Introduce a new `GroovyIntegrationFlowDefinition.splitWith()`
to avoid clashing with existing method
* Deprecate all other `split()` variants, but left one without arguments
for a default splitting options
* Fix doc for new splitter style

* * Fix tab indentations in `groovy-dsl.adoc`
2023-07-10 11:08:44 -04:00
Artem Bilan
34f901f7db Improve split() DSL (#8666)
* Introduce a `SplitterSpec` which can accept possible
splitter variants: `expression`, `function`, `ref` etc.
This way we are going to have a complex endpoint configuration
only with a single method argument.
* Use `SplitterSpec` in a newly introduced `splitWith()`
* Deprecate those `split()` methods which use `SplitterEndpointSpec`.
This method are complex enough because of their several arguments
* Refactor some common `MessageHandler` options initialization
into the `ConsumerEndpointSpec.doGet()`
* Disable failing now `MethodInvokingMessageProcessorTests.testCollectionArgument()`:
or Jackson problem, or fresh SF
* Groovy DSL will be fixed in the separate PR:
https://stackoverflow.com/questions/76595843/groovy-selects-a-defaultgroovymethods-split-instead-of-mine-one
2023-07-03 10:35:21 -04:00
pziobron
0798c8df95 GH-8659: Fix WatchService to react for renames
Fixes https://github.com/spring-projects/spring-integration/issues/8659

* GH-8659: Updating the documentation as requested

* GH-8659: Fixes requested after coder review

**Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**
2023-06-29 14:23:33 -04:00
abilan
019e96c925 Disable ImapMailTests.testIdleWithMessageMapping
It is not clear why IMAP GreenMail server closes its socket accidentally
2023-06-28 14:35:55 -04:00
Artem Bilan
43473836ef Remove unused ThreadLocal from RedisStoreMSource (#8663)
* Remove unused ThreadLocal from RedisStoreMSource

The `RedisStoreMessageSource` relies on an `IntegrationResourceHolder`
for a while already.
Its internal `ThreadLocal` is just out of use.

* Remove that `resourceHolder` property and related methods to interact with it.
* Mention the `IntegrationResourceHolder` and `store` attribute in the `redis.adoc`

* Fix language in Docs

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

---------

Co-authored-by: Gary Russell <grussell@vmware.com>
2023-06-28 13:40:48 -04:00
abilan
229e3cc081 Increase wait timeout in FluxMessageChannelTests 2023-06-28 13:21:41 -04:00
abilan
1690be45fc Decrease read timeout for GreenMail tests
This may give a chance for IDLE to restart more often
to read the actual INBOX state during the test
2023-06-28 12:53:25 -04:00
Artem Bilan
4583afe0ad GH-8611: Extract MessagingAnnotationBeanPostProcessor (#8661)
Fixes https://github.com/spring-projects/spring-integration/issues/8611

According to the latest Spring Framework requirements related to AOT the
`BeanDefinitionRegistryPostProcessor` must not do anything but only bean registrations

* Extract a `MessagingAnnotationBeanPostProcessor` component with a `BeanPostProcessor` logic
from the `MessagingAnnotationPostProcessor` and leave the last one as just
a `BeanDefinitionRegistryPostProcessor` impl
* Fix tests according to a new logic
2023-06-28 08:59:37 -04:00
Artem Bilan
13980af1e1 GH-8611: Extract IntegrationConfigurationReport (#8660)
Fixes https://github.com/spring-projects/spring-integration/issues/8611

According to the latest Spring Framework requirements related to AOT the
`BeanDefinitionRegistryPostProcessor` must not do anything but only bean registrations

* Extract an `IntegrationConfigurationReport` component
and move `IntegrationProperties` printing over here out from the
`DefaultConfiguringBeanFactoryPostProcessor`
* Remove a `SmartInitializingSingleton` impl from the `DefaultConfiguringBeanFactoryPostProcessor`
2023-06-27 12:32:33 -04:00
Artem Bilan
65c7e5dc5f Fix Kotlin DSL delegation (#8658)
The `ConsumerEndpointSpec` extensions for Kotlin
don't delegate to the provided `endpointFactoryBean`

* Introduce `KotlinConsumerEndpointSpec` extension for `ConsumerEndpointSpec`
with the proper delegation to the provided spec
* Use `KotlinConsumerEndpointSpec` in the Kotlin-specific `Spec` classes

**Cherry-pick to `6.1.x`, `6.0.x` & `5.5.x`**
2023-06-26 15:11:00 -04:00
Artem Bilan
af95829a3f GH-8654: Fix bean deps for messaging annotations (#8657)
Fixes https://github.com/spring-projects/spring-integration/issues/8654

Spring Framework has an ability to start dependant beans automatically
when we start the current one.

The `AbstractMethodAnnotationPostProcessor` is missing a bean dependency
registration causing errors in target applications when Messaging Annotations configuration is used.

* Add `registerDependentBean()` into an `AbstractMethodAnnotationPostProcessor` when we generate
and register a `ConsumerEndpointFactoryBean`
* Change one of the `ClientManagerBackToBackTests` configuration to rely on a `@ServiceActivator`
for `Mqttv5PahoMessageHandler` bean to ensure that change in the `AbstractMethodAnnotationPostProcessor`
has a proper effect

**Cherry-pick to `6.1.x` & `6.0.x`**
2023-06-26 14:59:55 -04:00
Artem Bilan
070c1c6e60 GH-8626: Provide cleaner transform() DSL (#8653)
* GH-8626: Provide cleaner `transform()` DSL

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

* Add missed `transform(String beanName, @Nullable String methodName)` API
* Introduce a `TransformerSpec` to expose a strict API to configure
transformer variants.
* Introduce `transformWith(Consumer<TransformerSpec>)` as a single point
of all possible transformer and its endpoint options
* Deprecate those `IntegrationFlowDefinition.transform()` variants
which are harder to configure as several lambda arguments

This change will make Kotlin & Groovy DSL more readable and straightforward

* * Use new `transformWith()` in tests where a deprecated API still used
* Add JavaDocs to `TransformerSpec`
* Fix generic types for `BaseIntegrationFlowDefinition.transformWith()` -
they make sense exactly on the `TransformerSpec.transformer()` only
* Apply `transformWith()` for Groovy DSL
* Introduce a new `ClassUtils.isLambda(Object candidate)`
and add a check for Groovy `Closure`
* Fix `GroovyIntegrationFlowDefinition.createConfigurerIfAny()` to propagate a `Consumer` argument
down to the `Closure`

* * Rename `TransformerSpec -> TransformerEndpointSpec` for better context
meaning of the class
* Introduce `KotlinTransformerEndpointSpec` as an extension of the `TransformerEndpointSpec`
to have an `inline fun <reified P> transformer(crossinline function: (P) -> Any)`
for Kotlin style
* Add `KotlinIntegrationFlowDefinition.transformWith(KotlinTransformerEndpointSpec)`
* Deprecate Kotlin methods which are covered by the mentioned `transformWith()`
* Fix tests to use new API
* Mentioned the change in the doc
2023-06-26 12:01:13 -04:00
abilan
ceb3daec8e GH-8655: Add channel to JMS samples in doc
Fixes https://github.com/spring-projects/spring-integration/issues/8655

In the text about Outbound Channel Adapters for JMS it reads:

> The following configuration produces an adapter that receives Spring Integration messages from the `exampleChannel` [...]

However, the is no this channel definition in Kotlin and Java DSL snippets

* Add an `exampleChannel` to Kotlin and Java DSL samples
* Add Groovy DSL sample for the same flow definition
2023-06-26 10:51:36 -04:00
abilan
881893dbca Remove debezium-bom import
The `debezium-bom` manages too many third-party deps which causes
an enforcement for our transitive deps where it is not always true
to use old versions

* Exclude `group: 'io.netty'` for `artemis-stomp-protocol`
to avoid possible Netty version override expected by `reactor-netty-http`
2023-06-23 11:05:10 -04:00
abilan
a7d9def99b More exclude from debezium to avoid conflicts 2023-06-22 17:51:16 -04:00
abilan
f50e16e02a Exclude com.datastax.cassandra group
Rely on Cassandra driver as transitive dependency from `spring-data-cassandra`
2023-06-22 17:32:28 -04:00
abilan
d37912f6a0 Remove https://repo.spring.io/release for Gradle 2023-06-22 17:18:46 -04:00
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