Commit Graph

11189 Commits

Author SHA1 Message Date
jatinsaxena
ddddd1d0a5 GH-3936: WebFluxMH: Add request attribute support
Fixes https://github.com/spring-projects/spring-integration/issues/3936

I am passing request attributes which is getting used in exchangefilter to influence the flow. This request attribute is of type String as Key and Value as a user defined object.

My expectation is to pass this information in request attributes so that it will eventually available in exchangefilter for further processing but i dont find a way to pass these request attribute in webflux integration.

* Add webclient request attributes into `WebFluxRequestExecutingMessageHandler`
* Improve code style and docs
2022-11-18 16:33:12 -05:00
abilan
91007e6745 Remove nohttp/allowlist.lines since all fixed 2022-11-18 16:10:09 -05:00
abilan
bfb2ca217f Upgrade dependencies including Gradle 2022-11-18 15:47:56 -05:00
Artem Bilan
3c40b01915 Expose more reflection hints (#3951)
* Expose more reflection hints

* Bring back `@Reflective` on `Pausable` - for possible end-user usage
* Add `ReactiveMessageHandler` hint since its method is used reflectively
in the `IntegrationRSocketMessageHandler`
* Add `@Reflective` on the `ServerRSocketMessageHandler.handleConnectionSetup()`
since it is used reflectively for a `registerHandlerMethod()`
* Add `KafkaRuntimeHints` to expose `Pausable` contract on Kafka inbound endpoints
for SpEL invocation via Control Bus
* Document native images support

* Fix language in docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-18 11:26:46 -05:00
abilan
18a87eaf2a Register Lifecycle methods for AbstractEndpoint
* Also register `Pausable` explicitly and remove its `@Reflective`.
This type is needed for Control Bus SpEL execution, but it might not
be available at runtime because not all endpoints implement it
2022-11-17 13:35:35 -05:00
abilan
264cc3c5f8 Add Lifecylce interface to reflection hints 2022-11-17 09:16:32 -05:00
abilan
7cbea7445d Fix new Sonar smell 2022-11-16 17:08:10 -05:00
abilan
a5f85968eb Add Pausable & ManageableSmartLifecycle for AOT
The `Pausable` & `ManageableSmartLifecycle` types are eligible to be used
from Control Bus.
This one is based on SpEL and therefore requires a reflection for those
types to be available in native image
2022-11-16 16:30:19 -05:00
Artem Bilan
508fb167df GH-3555: Change logger order for errorChannel (#3949)
* GH-3555: Change logger order for errorChannel

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

The default global `errorChannel` has a `LoggingHandler` as a subscriber.
It is subscribed without any `order` which may lose logging messages,
when another subscriber with re-throw is present.

* Set default `LoggingHandler` on the default `errorChannel` to `Ordered.LOWEST_PRECEDENCE - 100`
to give a room for custom subscribers without an `order` and still get error logged

* Add extra note in docs about an order for custom subcribers

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-16 15:10:26 -05:00
Artem Bilan
e9257958fe GH-3946: Revise Router channelKeyFallback option (#3948)
* GH-3946: Revise Router channelKeyFallback option

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

The `AbstractMappingMessageRouter` has both `resolutionRequired` and `channelKeyFallback`
as `true` by default.
End-users expects them to back off when they set a `defaultOutputChannel`.
They really want something similar to Java `switch` statement

* Change the logic in the `AbstractMappingMessageRouter` to reset `channelKeyFallback`
to `false` when `defaultOutputChannel` to avoid attempts to resolve channel from name,
but rather fallback to `defaultOutputChannel` as it states from th mentioned
Java `switch` statement experience
* Deprecate `RouterSpec.noChannelKeyFallback()` in favor of newly introduced `channelKeyFallback(boolean)`
* Call `channelKeyFallback(false)` from an overloaded `defaultOutputToParentFlow()`
to reflect the mentioned expected behavior in Java DSL as well.
* Respectively, deprecate `KotlinRouterSpec.noChannelKeyFallback()` wrapper
in favor of newly introduced `channelKeyFallback(channelKeyFallback: Boolean)`
* Remove redundant already `noChannelKeyFallback()` option in the `NoFallbackAllowedTests`
* Document the change and new behavior

* Fix `IntegrationGraphServerTests` to `setChannelKeyFallback(true)` explicitly

* Remove not relevant `default-output-channel` from the `DynamicRouterTests-context.xml`

* Reject an `AbstractMappingMessageRouter` configuration where `defaultOutputChannel` is provided
and both `channelKeyFallback` & `resolutionRequired` are set to `true`.
Such a state makes `defaultOutputChannel` as not reachable and may cause some confusions in target
applications.

* Remove `&` symbol from JavaDocs

* Fix `boolean` expression for `AbstractMappingMessageRouter` configuration check

* Fix `IntegrationGraphServerTests` for new router behavior

* Improve language in docs
2022-11-16 14:19:26 -05:00
abilan
60ba5444e7 GatewayProxyInitAotProcess: remove unused import 2022-11-16 12:05:44 -05:00
abilan
cece9afbf2 Fix GatewayProxyInitAotProcessor for proper type
The `GatewayProxyInitializationAotProcessor` uses mistakenly a `ProxyFactoryBean` type
instead of an expected `GatewayProxyFactoryBean`.
Looks like we don't need to scan for interfaces since they are properly transformed
to the `AnnotationGatewayProxyFactoryBean` bean definition during AOT phase
2022-11-16 11:51:11 -05:00
Artem Bilan
2f1c202c20 GH-3945: Fix not eligible for getting processed (#3947)
* GH-3945: Fix `not eligible for getting processed`

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

The `IntegrationManagementConfiguration` produces an `IntegrationManagementConfigurer` which is a `BeanPostProcessor`.
According to Spring recommendation this kind of infrastructure beans must be declared as `static`.
Due to an `implements ImportAware, EnvironmentAware` nature of the `IntegrationManagementConfiguration`,
we cannot use `static @Bean` method.
But since the `IntegrationManagementConfiguration` is not involved in any bean post-processing,
it is safe to follow recommendation and mark it as a `@Role(BeanDefinition.ROLE_INFRASTRUCTURE)`.

* Fix `MessagePublishingInterceptor` to initialize `MessagingTemplate` and `DestinationResolver` lazily
* Fix `AbstractMethodAnnotationPostProcessor` to initialize `DestinationResolver` lazily

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

* * Use `getChannelResolver()` internally in the `AbstractMethodAnnotationPostProcessor`
instead of direct property access which might not be initialized yet
* Use a plain `boolean` for `templateInitialized` in the `MessagePublishingInterceptor`
to avoid skips in other thread where and move on with still not initialized properties

* * Remove unused import

* * Fix `this.` prefix for `beanFactory` property reference
2022-11-15 14:47:46 -05:00
Gary Russell
77a752934d Improve Kafka Exception Message
- when we can't determine reply topic
2022-11-15 14:41:39 -05:00
Artem Bilan
88e259ccf2 Add observation for message channels (#3944)
* Add observation for message channels

* Add observation for message channels

The `MessageChannel.send()` is, essentially, only the point in Spring Integration where we produce a message
and can emit a `PRODUCER` kind span.

* Implement `IntegrationObservation.PRODUCER` infrastructure based on the `MessageSenderContext`
* Implement an observation emission in the `AbstractMessageChannel` based on the mentioned `IntegrationObservation.PRODUCER`
* Build a `MutableMessage.of(message)` to be able to modify message header in the `MessageSenderContext` via tracer `Propagator`
or other tracing injection instrument
* Document which components are instrumented with an `ObservationRegistry`

* Fix language in docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-15 14:11:12 -05:00
abilan
4d2a4cad76 Fix GatewayProxyInstPProc for AOT expectations
Turns out the AOT engine deals only with indexed constructor arguments for bean definition

* Rework `GatewayProxyInstantiationPostProcessor.processAheadOfTime()`
to populate a service interface type as an indexed ctor argument instead of generic one
2022-11-15 13:33:53 -05:00
Gary Russell
e19e6d4726 GH-3942: Fix Race in Kafka OB Gateway
Resolves https://github.com/spring-projects/spring-integration/issues/3942

When determining the default reply-to topic/partition, we need to wait for assignment.

Already covered by `KafkaDslTests` (a recent build failure exposed this problem).

**No back-port - 5.5.x uses 2.7.x by default, which does not support this.**

5.5.x users can call `waitForAssignment` on the `ReplyingKafkaTemplate` that is
supplied to the gateways before sending messages.
2022-11-15 08:39:54 -05:00
abilan
2895a1eda9 Revert Spring WS BOM 2022-11-15 08:36:17 -05:00
Artem Bilan
da9660a7ae GH-3846: Document Hazelcast module (#3941)
* GH-3846: Document Hazelcast module

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

* Fix language in docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-14 16:28:51 -05:00
Gary Russell
73ba4485a1 Fix Author Typo 2022-11-14 15:19:31 -05:00
abilan
e3ec94b230 Optimize DefaultFileNameGenerator for expression
The default expression in the `DefaultFileNameGenerator`
is based on a message header which simply can be retrieved
with much faster `FunctionExpression`

* Some other code style refactoring in the `DefaultFileNameGenerator`
2022-11-14 12:26:35 -05:00
abilan
ece3198ee9 Upgrade to MongoDB driver 4.8.0-rc0 2022-11-14 11:15:07 -05:00
abilan
7864658d01 GH-3686: Apply SF editor config
Fixes https://github.com/spring-projects/spring-integration/issues/3686

* Add `src/idea` with respective editor config for IntelliJ IDEA.
Must be imported into an IDE
* Add `src/eclipse` with respective editor config for Eclipse/STS
* Reformat imports in source code according a new editor config
2022-11-14 10:55:21 -05:00
abilan
bca9d27a65 Fix Gateway proxy registration for AOT
The `GatewayProxyInstantiationPostProcessor` does nothing on the AOT phase.
Therefore, scanned and imported beans for `@MessagingGateway` are not decorated
after AOT

* Implement a `BeanRegistrationAotProcessor` in the `GatewayProxyInstantiationPostProcessor`
to `RegisteredBean.getMergedBeanDefinition()` withe respective `AnnotationGatewayProxyFactoryBean`
and its requirements for ctor arg and `targetType`
* Scan for the `@MessagingGateway` bean in the `GatewayProxyInitializationAotProcessor`
to register respective proxy hints
2022-11-11 09:34:08 -05:00
artembilan
b80f107d9b Ignore empty value for observationPatterns 2022-11-10 09:36:05 -05:00
artembilan
75b198d0c1 ObservationPatterns as property placeholder
Make an `@EnableIntegrationManagement.observationPatterns`
as property placeholder aware and also support comma-separated values
2022-11-10 09:26:44 -05:00
artembilan
7bb330aaa9 Re-order mavenBom imports
It looks like some of Spring project's bom added after `spring-framework-bom`
causes a mess with dependencies: it brings those SF deps which are in the
latest `mavenBom`

* Move `spring-framework-bom` to the end of the list to be sure that
its version comes properly
* Do the same for Spring Data - after Spring AMQP and Spring Kafka
2022-11-09 17:39:16 -05:00
artembilan
0f4c941577 Use spring-ws-bom dependency 2022-11-09 16:38:24 -05:00
artembilan
727f1eb851 Adjust gateway proxy to the latest SF
The SF now understands `targetType` on a `BeanDefinition` for `FactoryBean`

* Remove `FactoryBean.OBJECT_TYPE_ATTRIBUTE` from the `GatewayParser`
* Expose `targetType` on a bean definition for an `AnnotationGatewayProxyFactoryBean`
in the `IntegrationFlowBeanPostProcessor` for DSL definitions
2022-11-09 16:28:25 -05:00
artembilan
4c8172d594 Move to SNAPSHOTs; upgrade Tomcat to 10.1.1
* Use `spring-amqp-bom`, `spring-kafka-bom`
2022-11-09 11:48:48 -05:00
artembilan
4d5548c9ed Add BOM file into distZip with other libs 2022-11-09 09:32:14 -05:00
Spring Builds
748551ae51 [artifactory-release] Next development version 2022-11-08 20:11:26 +00:00
Spring Builds
70c1bb3b3d [artifactory-release] Release version 6.0.0-RC2 2022-11-08 20:11:22 +00:00
Artem Bilan
f9b5f6cf7c Rearrange build for docs
* Copy docs to the `$buildDir/reference` instead of `docs`
to make `asciidoctor` tasks to calculate their UP-TO-DATE key properly
* Generate `kdoc` outside the `docs` dir to not interfere with `asciidoctor`
2022-11-08 12:13:22 -05:00
Artem Bilan
da56586619 Upgrade to Reactor 2022.0.0; prepare for release 2022-11-08 10:30:23 -05:00
Artem Bilan
90caafb697 Attempt to resolve okhttp-digest from JCenter 2022-11-08 10:14:59 -05:00
Artem Bilan
37f9b32033 Use plugins-release repo, not local one 2022-11-08 09:38:38 -05:00
Artem Bilan
32ec26e253 Upgrade to the latest deps; RCs
* Downgrade Tomcat to `10.0.23` since SF-6.0.0-RC3 is not compatible yet
* Exclude `jakarta.activation` and `com.sun.mail` transitive deps to avoid
classpath conflict with Jakarta EE 10
2022-11-08 09:30:02 -05:00
Artem Bilan
60f453e9ff Upgrade to Jakarta EE 10
* Fix mail module to fit to the latest mail API requirements
* Fix the last Sonar smell in the `SmbShare`
* Remove redundant dependency for `hamcrest-core` in various modules
2022-11-07 17:05:22 -05:00
Artem Bilan
053c86ab05 GH-3938: Fix HTTP XML configuration for ambiguity (#3939)
* GH-3938: Fix HTTP XML configuration for ambiguity

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

The `encoding-mode` is a property of the `RestTemplate`.
Therefore, it cannot be set on the component configuration together with
an externally injected `rest-template`

Even if `HttpRequestExecutingMessageHandler` has an assertion for such
an ambiguity, the XML parser just ignores this `encoding-mode`
when it encounters the `rest-template`

* Fix `HttpAdapterParsingUtils.verifyNoRestTemplateAttributes()` to check for not allowed
attributes with a `encoding-mode` as well
* Remove a `default` from the `encoding-mode` to not cause an ambiguity in the parser
* Fix some typos in the `spring-integration-http.xsd`
* Rework `OutboundResponseTypeTests` to JUnit 5

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

* * Fix error handling for `encoding-mode` in the `HttpAdapterParsingUtils`
* Cover `encoding-mode` and `rest-template` ambiguity with a test against failing XML configuration

* * Improve error message for ambiguous attributes in the `HttpAdapterParsingUtils`
2022-11-07 15:47:19 -05:00
Artem Bilan
0d8e286572 GH-3903: Improve AOT for gateway proxy beans (#3904)
* GH-3903: Improve AOT for gateway proxy beans

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

* Fix `MessagingGatewayRegistrar` to set a `targetType` on the bean definition
instead of `FactoryBean.OBJECT_TYPE_ATTRIBUTE`
* Rework `GatewayProxyBeanRegistrationAotProcessor` to the
`GatewayProxyInitializationAotProcessor implements BeanFactoryInitializationAotProcessor`
to avoid custom code generation
* Remove tests which rely on the `FactoryBean.OBJECT_TYPE_ATTRIBUTE`

* * Add `setBeanClass(GatewayProxyFactoryBean.class)` to satisfy Spring container expectations

* * Rework `GatewayProxyInitializationAotProcessor` to deal with generics
we are exposing now on the `ProxyFactoryBean`
2022-11-07 13:59:05 -05:00
Artem Bilan
dc56c09578 Upgrade to Servlet 6.0, Tomcat 10.1.1
* Upgrade to Micrometer `1.10.0` GA; Jackson `2.14.0`, Spring Kafka `3.0.0-RC2`
2022-11-07 13:17:01 -05:00
Artem Bilan
e03a20981a Fix the latest Sonar smells in the SMB module 2022-11-07 12:05:01 -05:00
Artem Bilan
88d681f442 Register bean for IntComponentScanRegistrar
To avoid duplication for scanning register a `IntegrationComponentScanRegistrar`
as a bean by itself and check for its presence before scanning

* Exclude this bean definition from the AOT since its logic has already passed on AOT generation
and we don't need this bean at runtime any more
2022-11-05 12:19:26 -04:00
Artem Bilan
18fcd21137 Fix latest Sonar fixes
* Some code style improvement for SMB classes
* Make an `SmbSessionTests` based on the `SmbTestSupport` for faster execution, but not blocking on fake URL connection attempt
* Remove `AbstractMqttMessageDrivenChannelAdapter.Topic` model in favor of `LinkedHashMap` handling
2022-11-04 16:19:03 -04:00
Artem Bilan
d31f309752 More Sonar fixes 2022-11-03 17:28:54 -04:00
Artem Bilan
7084e9654a More Sonar fixes 2022-11-03 15:09:36 -04:00
Artem Bilan
53d044814f Fix AbstractMProducingHandler for ReactiveAdapter
Turns out there is a reactive adapter for `CompletableFuture`
which is not an intention of the further logic
2022-11-03 13:20:45 -04:00
Artem Bilan
5f1c0c17de Fix more issues from Sonar report 2022-11-03 12:44:26 -04:00
Artem Bilan
0b9bab313b Add Java DSL for Camel module and docs (#3937)
* Add Java DSL for Camel module and docs

* Introduce a `LambdaRouteBuilder` option into the `CamelMessageHandler`
to easily provide the Camel route just in-place

* * Fix language in docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2022-11-03 12:18:35 -04:00