Commit Graph

10855 Commits

Author SHA1 Message Date
Artem Bilan
761ccf2ed2 Upgrade To Gradle 7.3 2021-11-17 14:04:57 -05:00
Spring Builds
414667f999 [artifactory-release] Next development version 2021-11-16 21:17:50 +00:00
Spring Builds
f777c015ed [artifactory-release] Release version 5.5.6 2021-11-16 21:17:46 +00:00
Artem Bilan
f678514054 Upgrade dependencies; prepare for release 2021-11-16 14:48:42 -05:00
Artem Bilan
de0f91b777 GH-3677: Doc for URL conn customization in FeedCA (#3678)
* GH-3677: Doc for URL conn customization in FeedCA

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

If there is need to have a `URLConnection` customized, the `UrlResource`
has to be used instead of plain `URL` injection into the `FeedEntryMessageSource`

* * Add a sample to docs for connection customization
2021-11-16 12:21:17 -05:00
Artem Bilan
fb14976f61 GH-3675: Restore nativeHeaders for WebSocketInChA
Fixes https://github.com/spring-projects/spring-integration/issues/3675

The `WebSocketInboundChannelAdapter` removes a `SimpMessageHeaderAccessor.NATIVE_HEADERS`
from headers used to create an outbound message.
Turns out not all native headers are mapped by the `StompHeaderAccessor`
to the top-level header entries.

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-11-15 15:33:56 -05:00
Artem Bilan
3dabf7aec1 Fix Checkstyle violations
* Make version block for dependencies as code-switcher in the XML, ZeroMQ and Zookeeper docs
2021-11-15 12:21:52 -05:00
Artem Bilan
f5f1c82082 Some docs clean up for ZK & XML modules 2021-11-15 10:41:02 -05:00
Artem Bilan
6f3fdc76c1 Some docs clean up 2021-11-15 10:00:14 -05:00
Unseok Kim
db611028da GH-3672: Clean up Jdbc & ZK LockRegistry caches
Fixes https://github.com/spring-projects/spring-integration/issues/3672

* Clean up `JdbcLockRegistry`, `ZookeeperLockRegistry` cache automatically 
* setCapacity(int capacity) to cacheCapacity(int capacity)
* field rename `capacity`to `cacheCapacity`, add static
2021-11-11 16:36:27 -05:00
Artem Bilan
5452a6fbe6 Fix more Sonar smells 2021-11-11 12:20:25 -05:00
Unseok Kim
3c812440cf Change RedisLockRegistry cache to 100K
1_000_000 of cache entries take too much memory
2021-11-11 10:54:56 -05:00
Artem Bilan
85efb5f53c Take Docker registry from the DOCKER_REGISTRY_URL
Add a logic into the `TestUtils` to take a Docker registry URL
from the `DOCKER_REGISTRY_URL` ENV variable.
Use the value in the `GenericContainer` for image to pull.
Fallback to an official registry if no value
2021-11-10 17:19:41 -05:00
Artem Bilan
7f83f5f74a Revert AnnotationGatewayProxyFactoryBean logic
The `AnnotationGatewayProxyFactoryBean` can be configured via setters
and via annotation in the provided interface.

* Override `setProxyDefaultMethods()` to `true` only if annotation explicitly
provides `true`
2021-11-10 16:35:04 -05:00
Artem Bilan
5de072b666 Fix WebFluxMH for proper response handling
The `WebFluxRequestExecutingMessageHandler` does direct `ClientResponse.create(entity.getStatusCode())`
which comes with a `ExchangeStrategies.withDefaults()`.
Even if end-user configures a `WebClient` properly, the response is created with default strategies.

* Rework `WebFluxRequestExecutingMessageHandler` internal logic to call `ResponseSpec.toEntityFlux(BodyExtractor)`
instead of manual `ClientResponse.create()`
* Add unit test to the `WebFluxRequestExecutingMessageHandlerTests` to ensure that configured `maxInMemorySize`
on the `WebClient` strategies has an effect when response body is bigger than expected size

**Cherry-pick to `5.4.x`**
2021-11-10 16:06:06 -05:00
Artem Bilan
a27b1ec28f Revert method references back to lambdas
Turns out Java does cast for the method reference argument before really calling
a delegating method.

* Revert cast method references (`((ApplicationContextAware) this.handler)::setApplicationContext`)
back to lambdas - `context -> ((ApplicationContextAware) this.handler).setApplicationContext(this.applicationContext)`
This way the cast is deferred until the lambda is called.
2021-11-10 16:03:50 -05:00
Artem Bilan
0aac4c0a86 Fix new Sonar smells 2021-11-10 14:55:48 -05:00
unseok kim
e51513230a GH-3655: Add automatically delete for Redis Locks
Fixes https://github.com/spring-projects/spring-integration/issues/3655

* support automatically clean up cache
* RedisLockRegistry.capacity desc
2021-11-10 14:24:53 -05:00
Artem Bilan
25100d1ac7 Fix unused import in the IntegrationRegistrar 2021-11-05 10:31:51 -04:00
Artem Bilan
a899b37ac3 DefaultConfiguringBFPP to BDRegistryPP
* Make a `DefaultConfiguringBeanFactoryPostProcessor` as a `BeanDefinitionRegistryPostProcessor`
to let it be processed properly in Spring AOT
* Register `DefaultConfiguringBeanFactoryPostProcessor` as a `BeanDefinition.ROLE_INFRASTRUCTURE`,
so it is removed in Spring AOT after processing and writing target bean definitions
2021-11-05 10:24:18 -04:00
StandCN
e80a42d394 Fix typo in the MqttMessageSentEvent Javadoc 2021-11-05 09:45:45 -04:00
Artem Bilan
d86647807e Use ReflectionUtils.makeAccessible() - not direct
The `LambdaMessageProcessor` and `MethodInvokingMessageSource`
 call `method.setAccessible(true)` unconditionally.

* Use `ReflectionUtils.makeAccessible()` for some optimization
* Remove `Content is not allowed in prolog` from the `JaxbMarshallingIntegrationTests`
since it is locale dependant and not relevant for the unit test logic
2021-11-03 10:54:24 -04:00
Mauro Molinari
15520e120c GH-3652: File gateway: don't try delete no file
Fixes spring-projects/spring-integration#3652

Do not try to delete non-existing file in `FileExistMode.REPLACE` in the `AbstractRemoteFileOutboundGateway`

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-11-03 10:06:31 -04:00
Artem Bilan
eb4d583a17 Add toReactivePublisher(autoStartOnSubscribe) (#3657)
* Add `toReactivePublisher(autoStartOnSubscribe)`

The `IntegrationFlowBuilder.toReactivePublisher()` returns a `Publisher<Message<?>>`
which may be subscribed somewhere late in the application logic, e.g.
when WebSocket (or RSocket) subscription is initiated by the external client.
In between application context startup and that subscription moment, the `IntegrationFlow`
must not try to produce messages since there is nothing to consumer them from the
`Publisher<Message<?>>` side.
One of the way is to have a source endpoint not started automatically and control its
lifecycle from the point fo reactive subscription

* Introduce an `IntegrationFlowBuilder.toReactivePublisher(boolean autoStartOnSubscribe)`
to let the framework do a job for an `IntegrationFlow` lifecycle control.
This way end-user doesn't need to know autowire a starting endpoint and use `doOnSubscribe()`
and similar callbacks
* Change `ConsumerEndpointFactoryBean` log message about a `FixedSubscriberChannel`
to `INFO` since an `autoStartup = false` really does not have any effect and there is nothing
for end-user to worry about.
The `IntegrationFlow` knows nothing about each endpoint internals and cannot control which
mark as `autoStartup = false` and which not

* Fix languge in JavaDocs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2021-11-01 16:49:59 -04:00
Artem Bilan
fc7d338302 GH-3656: Fix package tangles
Fixes https://github.com/spring-projects/spring-integration/issues/3656

* Move `JavaUtils` from `util` package to the root one to break any possible
tangling to/from other packages.
* Deprecate an existing `JavaUtils` for backward compatibility
* Remove `@IntegrationConverter` from the `JsonNodeWrapperToJsonNodeConverter`
and register it manually in the `ConverterRegistrar`.
The bean registration for the `JsonNodeWrapperToJsonNodeConverter` must be removed
in the next `6.0`
* Remove usage of `IntegrationContextUtils` from the `support` package
2021-11-01 15:06:01 -04:00
Artem Bilan
f520156053 GH-3653: Improve DSL parsing performance (#3654)
* GH-3653: Improve DSL parsing performance

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

* Refactor `IntegrationFlowBeanPostProcessor` to perform `beanFactory.getBeansOfType()`
as less as possible
* Implement a `NamedComponent` on the `StandardIntegrationFlow` for better
bean scanning performance in the `IntegrationFlowBeanPostProcessor`

* * Skip `NamedComponent` from bean scanning if `beanName == null`
2021-11-01 10:25:38 -04:00
Artem Bilan
ff3b4d34a1 Fix Checkstyle violation in the XML config 2021-10-22 15:51:14 -04:00
Artem Bilan
ffdc992f2e Rework JpaOutboundGatewayParserTests to JUnit 5 2021-10-22 15:28:26 -04:00
Artem Bilan
ee8afc5b28 BeanDefinitions: Mix instanceSupplier and props 2021-10-22 15:17:46 -04:00
Artem Bilan
7d29cf7f02 Fix double the typo in docs 2021-10-21 14:17:35 -04:00
Artem Bilan
78366e7b00 GH-3647: Use remoteDirExpression in MV command (#3651)
* GH-3647: Use remoteDirExpression in MV command

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

To simplify a source and renameTo remote file expressions, the `remoteDirectoryExpression`
is consulted now, when they are not full paths.
This is useful when we want just to rename a remote file in some dir

* * Add JavaDoc for `getDirectoryExpressionProcessor()`
* Fix language in docs
2021-10-21 14:12:50 -04:00
Gary Russell
e84bab6e0a GH-3648: Fix @Gateway.payloadExpression
Resolves https://github.com/spring-projects/spring-integration/issues/3648

When configuring a gateway proxy with XML, but specifying the payload expression
on the method `@Gateway` annotation, the expression was ignored, even though it
had been parsed.

`@Payload` worked.

With this change, if both `@Payload` and `@Gateway` are defined on a gateway method,
`@Gateway.payloadExpression` wins.

* Fix doc links.
2021-10-20 15:09:29 -04:00
Spring Builds
035581b421 [artifactory-release] Next development version 2021-10-19 19:00:50 +00:00
Spring Builds
c822eb2204 [artifactory-release] Release version 5.5.5 2021-10-19 19:00:47 +00:00
Artem Bilan
d61df01acf Fix DSL sample in the doc
* Improve JavaDocs for `BaseIntegrationFlowDefinition` with renaming `payloadType`
param to `expectedType` since it can also be as a `Message.class`, not only type
for the payload.
* Add JavaDoc for `LambdaMessageProcessor` ctor
2021-10-19 14:19:58 -04:00
Anthony Schweigard
7e5fef9e45 GH-3641: Handle duplicate cookies properly
Fixes https://github.com/spring-projects/spring-integration/issues/3641

When a duplicate cookie name appears in a request, an `IllegalStateException` is thrown.
The default `Collectors.toMap()` does not allow a duplicated keys.

* Handle `servletRequest.getCookies()` as a `MultiValueMap`
* Call `toSingleValueMap()` for the evaluation context variable to restore previous behavior.
The next major version must expose the `MultiValueMap` as is to give access to all cookies from end-user expressions
* Rework some HTTP tests to JUnit 5

**Cherry-pick to `5.4.x` & `5.3.x`**
2021-10-19 13:26:22 -04:00
Artem Bilan
6c47593aef Fix ExpressionUtilsTests according SF changes
Related to: https://github.com/spring-projects/spring-framework/issues/27446
2021-10-19 09:46:35 -04:00
Artem Bilan
1341a457f0 Upgrade dependencies 2021-10-18 17:30:12 -04:00
Artem Bilan
72b9e7001e GH-3643: Defer MeterRegistry bean dependency
Fixes https://github.com/spring-projects/spring-integration/issues/3643

The `ImportBeanDefinitionRegistrar` register its bean definition in the early phase.
It causes a problem with Spring Boot when an explicit `@EnableIntegrationManagement`
is declared: the `MeterRegistry` is provided later on via auto-configuration
and `MicrometerMetricsCaptor` has no knowledge about `MeterRegistry` at the
`ImportBeanDefinitionRegistrar` phase.

* Reworks `MicrometerMetricsCaptorRegistrar` to the `MicrometerMetricsCaptorConfiguration`
and use special conditional `MicrometerMetricsCaptorImportSelector` for that
`@EnableIntegrationManagement`.
This way a `MicrometerMetricsCaptor` `@Bean` consults `ObjectProvider<MeterRegistry>`
on its creating time and returns `null` if no `MeterRegistry` beans at all.
2021-10-18 17:15:45 -04:00
Artem Bilan
a03af081af Upgrade to Gradle 6.9.1; fork JavaCompile
Attempt to rely on the forked process for compilation
according these docs: https://docs.gradle.org/current/userguide/performance.html#compiler_daemon
2021-10-18 11:24:31 -04:00
Artem Bilan
34d2b0904f Fix new Sonar smells 2021-10-07 10:59:43 -04:00
Gary Russell
e2557a42c2 GH-3617: KPMH - Option To Use Template's Converter
Resolves https://github.com/spring-projects/spring-integration/issues/3617

Optionally use the `KafkaTemplate` message converter instead of the default
(or supplied) `ProducerRecordCreator`.
2021-10-06 16:10:57 -04:00
Artem Bilan
0410343f7f Rework all the MQTT tests to JUnit 5
* Use `MosquittoContainerTest` for all the MQTT integration tests
* Remove MQTT `BrokerRunning` JUnit 4 rule
* Mark `BackToBackAdapterTests` with `@LongRunningTest` as it is really too slow
2021-10-06 13:30:12 -04:00
Artem Bilan
e7c0d8dafa GH-3432: Add MQTT v5 channel adapters (#3639)
* GH-3432: Add MQTT v5 channel adapters

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

* Add `optional` dependency for `org.eclipse.paho:org.eclipse.paho.mqttv5.client`
* Add `MqttProtocolErrorEvent` and emit it from the `mqttErrorOccurred()` callback of the MQTT v5 client
* Add `MqttHeaderMapper` since MQTT v5 has introduced user properties pair to transfer over the protocol
* Add `Mqttv5PahoMessageHandler` as one more extension of the `AbstractMqttMessageHandler`
* Add more convenient `MqttHeaders` constants for easier headers mapping configuration
* Ensure via `Mqttv5BackToBackTests` that MQTT v5 is supported by the provided components
* Change `pr-build-workflow.yml` to use `eclipse-mosquitto` container for testing all the MQTT interactions
* Change `cyrilix/rabbitmq-mqtt` service to the `rabbitmq:management` since RabbitMQ does not support MQTT v5

* * Handle manual acks
* Add `Mqttv5PahoMessageDrivenChannelAdapter.persistence` property

* * Add documentation
* Add `MosquittoContainerTest` for TestContainers support with Mosquitto image

* Fix language in the docs after review

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2021-10-06 11:38:52 -04:00
Gary Russell
b8e414d4f6 GH-3637: Fix KafkaMessageSource First Poll
Resolves https://github.com/spring-projects/spring-integration/issues/3637

If there are no records to receive, the poll blocked for `20*pollTimeout`.

Wake the consumer during partition assignment; however, this changes the behavior
when there are records present - the first poll always returns no records.

Detect that the wakeup was due to assignment and perform another poll.

Also add some debug logging, and don't create a new consumer if the source was
stopped.

**cherry-pick to 5.4.x**
2021-09-30 16:34:33 -04:00
Artem Bilan
fe57fd281c Checkstyle changes
* Upgrade to Checkstyle 9.0
* apply some JavaDocs rules
* Fix JavaDocs rules violations
* Some other minor clean up in the affected classes
2021-09-28 11:55:25 -04:00
Spring Builds
d2e23c5f03 [artifactory-release] Next development version 2021-09-21 17:44:21 +00:00
Spring Builds
6268917239 [artifactory-release] Release version 5.5.4 2021-09-21 17:44:17 +00:00
Artem Bilan
3bfabb92ee Upgrade dependencies; prepare for release 2021-09-21 12:41:00 -04:00
Artem Bilan
726b216f07 Disable TcpNioConnectionTests.testCleanup()
The timeout is too short for CI server and there is
a high chance fo race condition with such a short `nioHarvestInterval`

* Use `@DisabledIfEnvironmentVariable(named = "bamboo_buildKey")`
to exclude the test from CI server, but still run it locally or in GH Actions
2021-09-20 11:36:23 -04:00