Commit Graph

9902 Commits

Author SHA1 Message Date
Gary Russell
841a91d2cb GH-3089: Fix since in gateway spec 2019-10-31 16:47:58 -04:00
Artem Bilan
6468ecc530 GH-3089: Add AmqpInGateway.replyHeadersMappedLast (#3091)
* GH-3089: Add AmqpInGateway.replyHeadersMappedLast

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

In some use-case we would like to control when headers from SI message
should be populated into an AMQP message.
One of the use-case is like a `SimpleMessageConverter` and its `plain/text`
for the String reply, meanwhile we know that this content is an
`application/json`.
So, with a new `replyHeadersMappedLast` we can override the mentioned
`content-type` header, populated by the `MessageConverter` with an
actual value from the message headers populated in the flow upstream

* Introduce an `AmqpInboundGateway.replyHeadersMappedLast`; expose it
on the DSL and XML level
* Use newly introduced `MappingUtils.mapReplyMessage()`
* Optimize `DefaultAmqpHeaderMapper` to not parse JSON headers at all
when `JsonHeaders.TYPE_ID` is already present (e.g. `MessageConverter`
result)
* Also skip `JsonHeaders` when we `populateUserDefinedHeader()`

**Cherry-pick to 5.1.x**

* * Fix language and package typos
* Add missed `@param` in JavaDoc of the `AmqpBaseInboundGatewaySpec.batchingStrategy()`
* Extract a `RabbitTemplate` `MessageConverter` to use for reply messages
conversion - pursue a backward compatibility
2019-10-31 16:25:40 -04:00
Artem Bilan
977997e3bf GH-3090: Add logout() to FtpSession.close()` (#3094)
* GH-3090: Add `logout() to `FtpSession.close()`

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

Without `logout()` the FTP session is not closed at all,
but just the connection is closed.
Some FTP servers close those sessions eventually anyway, but some just
leak with resources.

**Cherry-pick to 5.1.x & 4.3.x**

* * Migrate `SessionFactoryTests` to JUnit 5
2019-10-30 15:41:42 -04:00
Joaquin Santana
7aea76c6c4 GH-3026: Fix chmod support for DSL
Fixes https://github.com/spring-projects/spring-integration/issues/3026

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

* Populate proper `FileTransferringMessageHandler` impl from DSL spec
implementations.
This way we are able to use a provided `chmod` from Java DSL
* Added `FileTransferringMessageHandlerSpec` ctor TODO
* Update SftpTests
* Code cleanup; `@Ignore` `SftpTests.testSftpOutboundFlowWithChmod()`
since it doesn't work properly on Windows
2019-10-29 15:20:08 -04:00
Artem Bilan
66c3eff2ba Fix new Sonar smells 2019-10-29 08:11:31 -04:00
Artem Bilan
ca56a0eb80 Extract BaseIntegrationFlowDefinition (#3087)
* Extract `BaseIntegrationFlowDefinition`

Kotlin inline reified functions cannot override as syntax sugar generic
Java methods.

* Extract a `BaseIntegrationFlowDefinition` with strong typed methods,
plus those which doesn't have a syntax sugar variants
* Leave in the `IntegrationFlowDefinition` only those generic methods
which are just a syntax sugar without any types requirements

This way we can write Kotlin inline reified functions as an extension
 with the same names to make a Kotlin DSL much cleaner

* * Override methods in the IntegrationFlowDefinition for bytecode compatibility
* Extract `protected` getters and setters for `BaseIntegrationFlowDefinition`
properties to allow a proper extension
* Use those getters and setters in the code

* * Add // NOSONAR for overridden methods
2019-10-28 10:11:15 -04:00
Artem Bilan
1a2907eeb3 Upgrade dependencies; fix deprecations 2019-10-25 15:25:14 -04:00
Artem Bilan
ab06c21bbc Give access to AmqpOutboundEndpoint.RabbitTemplate
Related to https://github.com/spring-cloud/spring-cloud-stream/pull/1824

There are some use-cases when we would like to further customize a
`RabbitTemplate` encapsulated in the `AmqpOutboundEndpoint`.
For this purpose there is just enough to make its getter as `public`.
Also make a `AmqpHeaderMapper` available same way via `public` getter
2019-10-23 14:21:26 -04:00
Artem Bilan
a2e0dda4d8 Show Rsocket requestChannel in RSocketDslTests 2019-10-23 13:29:20 -04:00
Artem Bilan
375f3c1317 Ensure that dynamic routes are included into graph (#3085)
* Ensure that dynamic routes are included into graph

Modify an `IntegrationGraphServerTests` to be sure that dynamic routes
are included into the graph (with links) after sending a message to the
router and rebuilding a graph

* * Fix test for the actual numbers to expect
2019-10-21 15:19:17 -04:00
Gary Russell
612ae341ae TCP: Fix race in test
- since the deserializer is no longer volatile, we can't change it in the test
- move the "old behavior" test for the raw deserializer to a new test
2019-10-18 09:00:51 -04:00
Emmanuel Roux
c420c414d3 GH-3076: NioFileLocker: add file existence check
Fixes spring-projects/spring-integration#3076

* Return `null` instead of throwing an exception

* Fix license header

* Add missing `@since`

* Avoid over-engineered test logic

* Fix code style

* Test non-existent file does not get created

* Fix: remove unused import
2019-10-17 14:52:46 -04:00
Artem Bilan
1e50707370 Fix new Sonar smells 2019-10-17 10:09:55 -04:00
Artem Bilan
33667884a7 GH-3079: Use getMostSpecificMethod for SpEL calls (#3082)
* GH-3079: Use getMostSpecificMethod for SpEL calls

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

It turns out that we need to use a *most specific* method for the target
to be called reflectively from the SpEL

NOTE: We drop a *Method not found* error in case of wrong method source
since now we find a right source via `ClassUtils.getMostSpecificMethod()`

**Cherry-pick to 5.1.x**

* * `@Ignore` `MethodInvokingMessageProcessorTests.testProcessMessageMethodNotFound()`
instead of removal
2019-10-16 15:57:33 -04:00
Gary Russell
87af95ee7a GH-3083: Support @Header with dotted literals
Fixes https://github.com/spring-projects/spring-integration/issues/3083

`@Header("foo.bar")` means extract property `bar` from header `foo`.

Support `@Header("'foo.bar'")`, meaning get the value of header `foo.bar`.

**cherry-pick to 5.1.x, 4.3.x**
2019-10-16 11:13:19 -04:00
Artem Bilan
911cdc86b5 Refinement for gateway Mono processing (#3075)
* Refinement for gateway Mono processing

* Introduce a `MessagingGatewaySupport.MonoReplyChannel` instead of
`FutureReplyChannel` for better on demand handling and reusing a
`Mono` returned from the target handler
* Refactor `GatewayProxyFactoryBean` to identify a target return type
(including generics for `Function`) during initialization
* Handle a `Mono` return type via
`MessagingGatewaySupport.sendAndReceiveMessageReactive()`
* Some `@Nullable` in the `GatewayProxyFactoryBean` and `ExpressionUtils`
* Add `MonoFunction` test-case into the `FunctionsTests.kt`

* * Deprecate `GatewayProxyFactoryBean.setServiceInterface()` in favor of
ctor initialization
* Fix `GatewayProxyFactoryBean.setServiceInterface()` usage in tests
2019-10-14 15:31:04 -04:00
Gary Russell
7733da651f GH-3072: Allow JDBC inbound query changes
Resolves https://github.com/spring-projects/spring-integration/issues/3072

* Assert for selectQuery setter
2019-10-04 15:39:22 -04:00
Artem Bilan
2a8615539f Deprecate IntFlows.from(service, methodName)
The method reference together with a `IntegrationFlows.frm(Supplier<?>)`
do the trick to avoid a method name resolution and also gives us a code
navigation in the IDE
2019-10-02 10:58:03 -04:00
Spring Buildmaster
07b44aec18 [artifactory-release] Next development version 2019-10-01 17:15:56 +00:00
Spring Buildmaster
c9d68c5c55 [artifactory-release] Release version 5.2.0.RELEASE 2019-10-01 17:15:52 +00:00
Artem Bilan
d3d82db374 Upgrade to Spring AMQP 2.2 GA; prepare for release 2019-10-01 12:53:57 -04:00
Artem Bilan
9720c82f15 Fix Checkstyle for JPA test; typos
* Rework `try..catch` structures in the JPA test into an
`assertThatIllegalArgumentException()` and
`assertThatIllegalStateException()`
2019-10-01 11:08:34 -04:00
Artem Bilan
8a4864e03f GH-3061: Add @DirtiesContext to JPA tests
Fixes https://github.com/spring-projects/spring-integration/issues/3061

Without a `@DirtiesContext` we keep not only a ctx in the cache, but
also an embedded DB instance, which is shared between contexts.
When ctx cache clean up happens, several ctxes would like to destroy
their associated embedded DB which, essentially, is the same in-memory
instance

* The `@DirtiesContext` give us a chance to destroy embedded DB for
the particular ctx in isolation
2019-10-01 10:49:17 -04:00
Gary Russell
0926186f60 Upgrade Micrometer, Spring Security versions 2019-10-01 09:14:42 -04:00
Artem Bilan
37cc201aee Upgrade dependencies; fix deprecations 2019-09-30 21:48:50 -04:00
Artem Bilan
229676b12c Fix links in reactive-streams.adoc doc
Mention this new docs in the `whats-new.adoc`
2019-09-30 16:38:38 -04:00
Artem Bilan
007e1a0924 Improve in generics for some Publisher API 2019-09-30 15:17:36 -04:00
Artem Bilan
ad96ca49f1 Add Reactive Stream chapter into docs
* Improve `channel.adoc`: polishing, new channels, java config
* Make `LoadBalancingStrategy` in the `DirectChannel` ctor as
`@Nullable` to reflect the real logic behind

* More Dos and polishing according PR comments
* Mention WebFlux and RSocket endpoints in the `endpoint-summary.adoc`
table

* More reactive streams docs
* `SourcePollingChannelAdapter` polishing
* Wrap multi-value publisher into `Mono.just()` in the `AbstractMessageProducingHandler`
instead of emitting just only a first item for the standard reply

Doc polishing
2019-09-30 14:36:33 -04:00
Artem Bilan
eeb951b0da Fix new Sonar Smells
* Change `whats-new.adoc#x5.2-behavior` to point for the whole
`5.1-to-5.2-Migration-Guide`
2019-09-29 10:28:09 -04:00
Gary Russell
9994997917 GH-3067: Use default NullChannel instance if poss.
Resolves https://github.com/spring-projects/spring-integration/issues/3067

Also add missing receive counter.

* Late binding of null discard channel; checkstyle

* Fix test; fall back to new NullChannel(); always evaluate tx expressions
2019-09-27 17:14:51 -04:00
Gary Russell
0c7cae15da Upgrade to Jackson 2.10
* Remove extraneous code

* Realign white listing with similar implementation in Spring Security: c0b48338f4

* 2.10 GA
2019-09-27 12:25:41 -04:00
Gary Russell
f3850b7520 RSocket Doc Polishing 2019-09-27 11:31:06 -04:00
Artem Bilan
c4aceb6bb5 Hide toReactivePublisher() from lambdas (#3065)
* Hide `toReactivePublisher()` from lambdas

When an `IntegrationFlow` is declared via lambda, it is impossible
to materialize it as a `Publisher` since we lose a Lambda context and
finish with a `NoSuchBeanException` when we would like to inject that
`Publisher`

* Make `IntegrationFlowDefinition.toReactivePublisher()` as `protected`
and expose it on the `IntegrationFlowBuilder` level
* Use `Channels` as a singleton: no reason in overhead for its instances
* Some code style polishing for `IntegrationFlowDefinition`

* Restore `Channels.super()` call
2019-09-26 15:08:58 -04:00
Gary Russell
582574c413 Upgrade Reactor Version 2019-09-26 10:53:05 -04:00
Artem Bilan
3ca291c7c4 Fix new Sonar smell 2019-09-25 08:26:52 -04:00
Gary Russell
12e5a306f8 GH-3062: Polishing
- avoid log noise when test server stopped
2019-09-24 18:11:30 -04:00
Gary Russell
8ad802cdfe GH-3062: Fix Mail Tests Hang
Resolves https://github.com/spring-projects/spring-integration/issues/3062

Reliably stop the test mail servers before the test context is destroyed.
2019-09-24 16:55:32 -04:00
Artem Bilan
b12657c599 Document RSocket support
* Fix some typos in `webflux.adoc` and `dsl.adoc`
* Make `FunctionsTests.kt` more Kotlin friendly
* Improve RSocket components and tests for them,
especially rely on the default `RSocketStrategies` in the
target SF RSocket components
* Rework `ServerRSocketConnector.setClientRSocketKeyStrategy` to use the whole `MessageHeaders` for consultation.
It turns out that just destination is not enough since it can be used from different clients
* Make the key based on the provided `setupData` by default
* Include all the `MessageHeaders` into the `RSocketConnectedEvent`

* Improve Docs according review feedback and Docs in SF

Doc polishing
2019-09-24 14:55:04 -04:00
Artem Bilan
21335812a3 Remove IntegrationNode.Stats.deprecated const 2019-09-22 09:34:48 -04:00
Gary Russell
a550ebfaad Fix test after previous commit
- the deprecated field is now last instead of first
2019-09-21 11:34:47 -04:00
Gary Russell
7d949f7f8a Fix Sonar issues 2019-09-21 09:40:25 -04:00
Gary Russell
58c0b9885b Add failure counter to AbstractMessageSource
* Clear timers in AMH.destroy()
2019-09-20 10:53:18 -04:00
Artem Bilan
aa29bb15e3 Guard Micrometer stats for NPE: no Micrometer
If there is no Micrometer in classpath, the `timers` and `counters`
are not populated into Graph

* Check for `null` before calling `Supplier`
2019-09-20 09:45:04 -04:00
Artem Bilan
c4ec73f9a0 Fix Checkstyle violation 2019-09-20 09:30:22 -04:00
Gary Russell
87840bcfe4 GH-3056: Add Micrometer Metrics to Runtime Graph
Resolves https://github.com/spring-projects/spring-integration/issues/3056

* Retrieve meters each time the graph is rendered, not just when it is built.
2019-09-20 09:15:55 -04:00
Artem Bilan
528203e606 Upgrade dependencies
* Use a `dependencyManagement` for those projects which bring BOMs
* Fix `RSocketOutboundGateway` for the latest SF
2019-09-18 17:31:27 -04:00
Artem Bilan
50c6f3a30c GH-3054: Resolve deprecation for WebFlux module
Fixes https://github.com/spring-projects/spring-integration/issues/3054
2019-09-13 18:36:10 -04:00
Gary Russell
3e30625ac9 Fix FtpServerOutboundTests.allEvents test
Spurious events captured from other tests.
Only capture events for the test's session.
2019-09-13 16:59:06 -04:00
Gary Russell
185d370415 Back to Spring Snapshots and other upgrades 2019-09-13 16:42:02 -04:00
Artem Bilan
9272782a48 GH-3052: Fix custom converters for lambdas
Fixes https://github.com/spring-projects/spring-integration/issues/3052

Starting with version `5.1`, a `LambdaMessageProcessor` is based on the
`MessageConverter` instead of plain `ConversionService`.
(A `ConfigurableCompositeMessageConverter` is used from the application
context.)
However a type conversion based on the `@IntegrationConverter` is lost
in the `GenericMessageConverter`  because it doesn't use an
`integrationConversionService` from the application context

* Change `ConfigurableCompositeMessageConverter` to configure a
 `GenericMessageConverter`  with an  `integrationConversionService`
 if any
* Fix `MessagingMethodInvokerHelper` to populate a `BeanFactory` into
its internal `ConfigurableCompositeMessageConverter`
* Ensure in the `LambdaMessageProcessorTests` that
`@IntegrationConverter` is applied for ``LambdaMessageProcessor` as well

**Cherry-pick to 5.1.x**
2019-09-13 18:37:33 +01:00