Commit Graph

10791 Commits

Author SHA1 Message Date
Dominik Simmen
c189a125a6 Safely read expunged IMAP messages
If application is connected to a Domino mail server via IMAP, it can happen from time to time that a message is expunged.
This leads to a `MessageRemovedException` when calling `IMAPMessage#getSubject`.
And although debug is set to false this again leads to a `MessageException` and the whole integration flow stops.

* Check for `isExpunged()` before logging a filtered message

* Add `@author`
* Fix debug message for expunged to reflect reality
* Clean up new unit tests a bit

**Cherry-pick to `5.4.x`**
2021-08-09 11:23:26 -04:00
trungPa
b12540d2ac GH-3598: Fix delay in waitStopListening()
Fixes spring-projects/spring-integration#3598

`TestingUtilities.waitStopListening(serverConnectionFactory, delayArg)` actually waits 
for `delayArg * 2` milliseconds which is inconsistent with the JavaDocs.

* Fix `TestingUtilities.waitStopListening()` to sleep for `100` between attempts and 
compare `n` attempts against `delay / 100`
2021-08-09 10:32:30 -04:00
Artem Bilan
0a7ea59198 GH-3601: Bring AMQP byte code compatibility back
Fixes https://github.com/spring-projects/spring-integration/issues/3601

The issue https://github.com/spring-projects/spring-integration/issues/3584
has introduced a regression when old constructor with an
`AbstractMessageListenerContainer` was removed in favor of just
`MessageListenerContainer`.
But with that change all the dependant projects must be recompiled,
which is not a case when Spring Cloud was not released against the
latest Spring Boot.

**Cherry-pick to `5.4.x`**
2021-07-30 13:42:46 -04:00
Artem Bilan
91d09c8ad3 Add deprecation suppression for spring-kafka-2.8
Spring for Apache Kafka 2.8 has introduced an new `CommonErrorHandler`
and deprecated its retying components including `RetryingMessageListenerAdapter`.

* For proper compatibility with `spring-kafka-2.8.0`, which is going to be
a foundation for upcoming Spring Boot 2.6, it is better to suppress deprecations
and don't raise such a concern to end-users.

In the future we will revise retrying logic to expected behavior from `spring-kafka-2.8.0`.
Or will do home-made one as it is now with `AmqpInboundChannelAdapter`, for example.

See https://github.com/spring-projects/spring-integration/issues/3605
2021-07-29 16:39:57 -04:00
Gary Russell
1b7d622777 GH-3600: Fix Kafka Tx Synchronization
Resolves https://github.com/spring-projects/spring-integration/issues/3600

Previously, the `KafkaProducerMessageHandler` did not synchronize a transaction
with some other transaction (e.g. JDBC); it published in a local transaction instead.

Also configure the Gradle Kotlin Daemon to work with JDK 16.

**cherry-pick to 5.4.x**
2021-07-28 11:54:31 -04:00
Artem Bilan
1951d5230c Fix java-dsl-gateway double usage in Docs 2021-07-27 15:19:36 -04:00
trungPa
61153578c5 GH-3549: Clean up more SonarQube smells
Fixes https://github.com/spring-projects/spring-integration/issues/3549
2021-07-27 11:24:14 -04:00
Artem Bilan
2be6d86ff9 Upgrade setup-jfrog-cli to fix deprecation 2021-07-26 16:17:53 -04:00
trungPa
9e512186ed GH-3549: Fix minor SonarQube smells
Fixes https://github.com/spring-projects/spring-integration/issues/3549
2021-07-23 11:07:39 -04:00
Spring Builds
bc8246d267 [artifactory-release] Next development version 2021-07-20 16:20:43 +00:00
Spring Builds
63073e4ee4 [artifactory-release] Release version 5.5.2 2021-07-20 16:20:37 +00:00
Artem Bilan
ed143ba790 Upgrade dependencies; prepare for release 2021-07-20 11:45:53 -04:00
Artem Bilan
f64b602b23 Fix code smell in the JdbcChannelMessageStore
* Refine JavaDocs in the `JdbcChannelMessageStore`
2021-07-20 09:39:02 -04:00
Artem Bilan
5ec8913d27 Fix pattern how Lock.unlock() is used
Related to https://build.spring.io/browse/INT-MAIN-84/

The `lock.unlock()` must be called in the `finally` block of the
nested `try..catch`, not in the outer which may just fail on `lock.lockInterruptibly()`
in which case there is just not going to be anything we can `unlock()` in the end

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-19 17:07:54 -04:00
Artem Bilan
dbc8af937b GH-3591: Add gateway() section into dsl.adoc (#3593)
* GH-3591: Add `gateway()` section into `dsl.adoc`

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

* Apply review requested changes
2021-07-19 15:55:53 -04:00
Artem Bilan
af9e69c251 Make MessageHistory JSON-serializable
* Add `org.springframework.integration.history` to trusted default packaged of the `JacksonJsonUtils`
* Add `@JsonCreator` to `MessageHistory` `private` ctor to let it to be created automatically by Jackson
* Add `equals()` and `hashCode()` into `MessageHistory` for the proper `Message` comparison
* Add  `MessageHistory` into headers for testing with Redis JSON (de)serialization

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-19 12:37:05 -04:00
trungPa
9c718c37a6 GH-3424: Refactor to use logging methods from LogAccessor
Fixes https://github.com/spring-projects/spring-integration/issues/3424

* Use `LogMessage.format()` for lazily formatting

* Fix some logging statements in `JdbcChannelMessageStore`
2021-07-19 11:30:01 -04:00
Artem Bilan
39c3acb042 Fix ZMQMessageHandlerTests race condition
Use `receiveTimeOut = 0` on SUB socket and rely
on the retries from the `await().atMost()`.
Also resubscribe in the retry callback before publishing the next attempt
2021-07-09 11:38:03 -04:00
Artem Bilan
0297f6bc9f Fix dsl.adoc for the actual API around Supplier 2021-07-08 16:25:38 -04:00
Artem Bilan
ca9c9192c7 Fix new sonar smell
The `GatewayMethodMetadata.headerExpressions` is never `null`
2021-07-08 14:11:22 -04:00
Artem Bilan
4b83241e90 Fix new Sonar smells 2021-07-08 12:24:28 -04:00
Artem Bilan
920b8ae744 ZeroMQ test: Add sleep between SUB & PUB 2021-07-07 15:57:44 -04:00
Artem Bilan
a5776524e2 Fix SourcePollingChAdFB autoStartup propagation
The `spring.integration.properties` can come with the `noAutoStartup`
property where we can specify a source polling channel adapter endpoint to
not start automatically.
Turns out the `SourcePollingChannelAdapterFactoryBean` propagates its
`autoStartup` property unconditionally which will skip the `noAutoStartup` value
because an `AbstractEndpoint.setAutoStartup()` sets an `autoStartupSetExplicitly` state

* Fix `SourcePollingChannelAdapterFactoryBean` to rely on a `Boolean` object state
and don't call target endpoint `setAutoStartup()` if it was not set
* Adjust `spring.integration.properties` in tests to use `noAutoStartup`
for some `SourcePollingChannelAdapterFactoryBean`
* Verify that property was applied in the `IntegrationFlowTests.testWithSupplierMessageSourceImpliedPoller()`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-07 13:47:50 -04:00
Artem Bilan
db4f120dac Functional gateway bean definitions
* Rework `MessagingGatewayRegistrar` to parse messaging gateway annotation
an `<gateway>` XML using a supplier variant for bean definition.
Such a feature is required by Spring Native - otherwise we would need to
register reflection info for to many internal Spring Integration classes
* Such a change should benefit from regular JDK perspective, too -
we don't do reflection for this kind of bean registrations
2021-07-06 12:58:09 -04:00
Artem Bilan
1ac163330e Remove unused imports
**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 15:51:50 -04:00
Artem Bilan
b103752e68 Fix NPE for @Indexed in the MessagingGatewayReg
The `@Indexed` comes without any attributes, but it is included
into a chain via `importingClassMetadata.getMetaAnnotationTypes(ann)`.
So, skip attributes from meta annotation when it is `null`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 15:28:06 -04:00
Artem Bilan
3cf1d35d52 Fix CORS registration for IntGraphController
We fail with `NoClassDefFoundError` when we use `@EnableIntegrationGraphController`
in WebFlux env without Spring MVC.
Another issue that we don't register CORS for WebFlux

* Extract top-level package protected classes for MVC and WebFlux to register CORS
in the appropriate environment according classpath
* Adjust `HttpIntegrationConfigurationInitializer` and `WebFluxIntegrationConfigurationInitializer`
for native compatibility
* Add `@Indexed` for `@MessagingGateway` for indexer support in Spring Boot and Spring Native

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-07-01 14:44:03 -04:00
Gary Russell
76f77ccd2c GH-3584: Support spring-amqp 2.3.x and 2.4.x 2021-06-24 14:48:01 -04:00
Spring Builds
52bfb7cd40 [artifactory-release] Next development version 2021-06-23 18:58:51 +00:00
Spring Builds
c10af07cd1 [artifactory-release] Release version 5.5.1 2021-06-23 18:58:46 +00:00
Artem Bilan
19e53a9343 Upgrade dependencies; prepare for release
* Migrate `MBeanTreePollingChannelAdapterParserTests` to JUnit 5
2021-06-23 13:08:57 -04:00
Artem Bilan
60b355bc38 Move subscription to PUB after connection
Looks like `subSocket.subscribe("test");` is lost when there is no
other side of PUB/SUB connection
2021-06-23 10:33:28 -04:00
Artem Bilan
353e99aa80 Rework ZeroMqMessageProducerTests for XPUB
* Use an `XPUB` socket to receive subscriptions before publishing.
This makes the test more robust and less blocked for that `Thread.sleep()`
2021-06-22 17:05:46 -04:00
Artem Bilan
7072cf1ab0 Increase timeout in ZeroMqMessageHandlerTests 2021-06-22 12:05:04 -04:00
Artem Bilan
cd7465a370 Rework ZeroMQMH test for Awaitility
Turns out PUB socket doesn't care if there are subscribers to it or not.
The sent message may be just lost in between.

* Resend message in the test until it is received by subscriber
* Use `await().untilAsserted()` to iterate the logic at most 10 seconds
2021-06-22 11:36:27 -04:00
Artem Bilan
dfd577596e Increase expiration time for RedisLock in test 2021-06-17 11:41:24 -04:00
Artem Bilan
d7dfea7bd0 Optimize ZeroMqMessageHandlerTests for ZMQ.Poller
* Fix unused import in the `IntegrationDynamicWebSocketHandlerMapping`
2021-06-17 11:21:57 -04:00
Artem Bilan
93743f69fe Fix dynamic Websocket endpoints for SockJS (#3581)
* Fix dynamic Websocket endpoints for SockJS

Related to https://stackoverflow.com/questions/67971467/registration-of-dynamic-websocket-at-application-initialization-time-and-at-runt

The SockJS wrapper for dynamic endpoint is not initialized properly.
Technically we just don't map to the SockJS service if such one is requested from the `ServerWebSocketContainer` configuration

* Postpone the path mapping for the target endpoint until after the `ServerWebSocketContainer` applies all the options
into its registration to expose.
* Fix `ServerWebSocketContainer` to propagate a default `TaskScheduler` for underlying SockJS Service on the endpoint
* Fix `IntegrationDynamicWebSocketHandlerMapping` to deal with path patterns as well,  which is the case for the mentioned SockJS wrapper:
the SockJS Service is able to handle the rest of the path according its setting and request requirements

* * Fix unused imports
* Add Javadoc for new `ServerWebSocketContainer.setSockJsTaskScheduler()` API

* * Cover SockJS server configuration in the WebSocketDslTests
2021-06-15 10:16:20 -04:00
KyeongMoon
8348b91ecc Fix typo in the InboundChannelAdapter JavaDocs 2021-06-15 09:33:03 -04:00
Artem Bilan
6ef079819b Fix Websocket dynamic registration mapping order (#3580)
Related to https://stackoverflow.com/questions/67923303/dynamic-registration-of-websocket-output-adapter-is-not-working

By default the `AbstractHandlerMapping` comes with the `order = Ordered.LOWEST_PRECEDENCE` which sorts
added mappings to the end of chain.
At the same time Spring Boot registers a `SimpleUrlHandlerMapping` as a fallback for all not handled requests
leaving our own mapping behind consideration

* Add `order = 0` to the `IntegrationDynamicWebSocketHandlerMapping` bean registration to let it to be
consulted before `SimpleUrlHandlerMapping`
* Add a note into `web-sockets.adoc` that `@EnableWebsocket` would disable Spring Integration dynamic WebSocket
endpoints
2021-06-11 15:20:33 -04:00
Artem Bilan
e28bdc87e2 Fix channel-adapter.adoc for incorrect code block 2021-06-11 11:07:40 -04:00
Artem Bilan
3ddaad9991 GH-3578: Fix JdbcMessageStore.getMessageGroup() (#3579)
Fixes https://github.com/spring-projects/spring-integration/issues/3578

The `JdbcTemplate.queryForMap()` extract values for columns to the closer target driver types.
For example H2 and Derby return `Long` for `BIGINT`.
Oracle for its `NUMBER(19,0)` returns `BigInteger`.
This makes the code in the `JdbcMessageStore.getMessageGroup()`
not platform independent.

* Fix `JdbcMessageStore` to map `ResultSet` to the `MessageGroupMetadata`
directly.
Mostly reinstating the previous behavior
* For that reason expose a default ctor for `MessageGroupMetadata`
and extract some setters to make code in the `JdbcMessageStore` more cleaner.
* This opens for us a possibility to implement a `MessageGroupStore.getGroupMetadata(groupId)`
for `JdbcMessageStore`
* Fix deprecation for `Flux.limitRequest()`
2021-06-10 15:54:40 -04:00
Jay Bryant
703ddc86e3 Link documentation formats
* Add a link from the HTML to the PDF and vice-versa.
* Update doc link text
* I missed that we have three formats: single-page HTML, multiple HTML pages, and PDF.
This commit links the single-page HTML and PDF to the other two formats.
2021-06-08 17:28:59 -04:00
Gary Russell
0b223369ed Fix Sonar Issue 2021-06-04 11:03:14 -04:00
Gary Russell
95fce11b0a GH-3573: Add ConsumerRecord(s) to ConversionExcep.
Resolves https://github.com/spring-projects/spring-integration/issues/3573
2021-06-03 12:47:19 -04:00
Frank Pavageau
f290c340f3 GH-3570: Disable the generation of the Gradle metadata
Fixes spring-projects/spring-integration#3570

The module file with the Gradle metadata cannot be published on Maven
Central, which causes issues for some people using a repository manager such
as Artifactory. If it doesn't return a 404 HTTP status, the build fails
instead of ignoring the module.

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-05-27 12:19:02 -04:00
Mário Dias
415296a00f GH-3509: Fix regression in TcpNetServerConnectionFactory
Related to https://github.com/spring-projects/spring-integration/issues/3509

* Fix intercepted connection cleanup tests
* Add missing logic to call `setSenders()` on wrapped connection

**Cherry-pick to `5.4.x`**
2021-05-26 11:28:10 -04:00
Culebras
b7cc2a162d GH-3567: JdbcLockRegistry: Retry TransactionSysEx
Fixes https://github.com/spring-projects/spring-integration/issues/3567

* Retry for TransactionSystemException in JdbcLockRegistry

* Unit test added for `TransactionSystemException`

* Completing author and copyright year information

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-05-26 09:54:50 -04:00
Artem Bilan
b2e0635ce2 Escape build info values
Currently the action fails with a `line 1: syntax error near unexpected token `('` error.
Just because our build name is: `Spring Integration - Main (5.5.x) - Default Job`

See more info in this SO: https://stackoverflow.com/questions/61795201/github-action-failed-syntax-error-near-unexpected-token

* Wrap `Build Name` value into double quote
2021-05-18 17:16:53 -04:00
Spring Builds
14a64a78a6 [artifactory-release] Next development version 2021-05-18 20:56:26 +00:00