Commit Graph

10519 Commits

Author SHA1 Message Date
Artem Bilan
dbbd855fb8 More Redis Streams tests tweaks 2020-10-08 11:04:30 -04:00
Artem Bilan
68379b6fb1 Some Redis Streams tests improvements 2020-10-08 10:35:26 -04:00
rohan mukesh
6d6f53fa87 Fix r2bdc componentType; Redis Streams ack issue
The R2DBC channel adapters have wrong componentType

* Fix R2DBC component type to not mention `reactive-`: they are reactive by R2DBC definition

The `ReactiveRedisStreamMessageProducer` calls ack() explicitly
when populates `IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK` header,
but must provide an implementation of `SimpleAcknowledgment` instead

* Fix `ReactiveRedisStreamMessageProducer` to populate the proper
`IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK` header and in the proper moment
* Fix `ReactiveRedisStreamMessageProducerTests` to verify that `autoAck=false` works as expected
together with the `IntegrationMessageHeaderAccessor.ACKNOWLEDGMENT_CALLBACK` header functionality
2020-10-07 17:06:49 -04:00
Artem Bilan
94e6521510 Fix some new Sonar smells 2020-10-07 12:31:44 -04:00
Artem Bilan
d8dd19106c Fix some unchecked warnings in tests 2020-10-07 11:54:21 -04:00
Artem Bilan
bc63a0dac8 More LogAccessor; some new Sonar smells 2020-10-06 16:31:43 -04:00
Artem Bilan
fe0e54c46d Fix AMQP & MQTT tests for LogAccessor 2020-10-06 14:41:32 -04:00
Artem Bilan
c7ff99a4e8 Use LogAccessor from SF
* Change main classes to use a `LogAccessor` API to simplify code flow
* Fix tests according `LogAccessor` property
* Fix some Sonar smells
2020-10-06 13:56:50 -04:00
Gary Russell
a66e82b0aa GH-3396: Add Docs for Micrometer MeterFilters
Resolves https://github.com/spring-projects/spring-integration/issues/3396

* Add an example.
2020-10-02 14:32:44 -04:00
Gary Russell
cbe37e8942 GH-3395: Fix XML expression default for ARFOGateway
Resolves https://github.com/spring-projects/spring-integration/issues/3395

Outbound remote file gateway parser requires `expression` even though some
commands don't need or use it.

* Propagate the empty string for `expression` attribute
* Fix default (`payload`) expression logic in the `AbstractRemoteFileOutboundGateway`

**Cherry-pick to `5.3.x`**
2020-10-02 14:31:53 -04:00
Artem Bilan
c934adbd1b Various fixes
* Adapt to WebFlux deprecations: https://github.com/spring-projects/spring-framework/issues/25751
* Back to SNAPSHOTs
* Fix new Sonar smells
2020-09-28 15:38:16 -04:00
Alex Sherwin
0cad53abcf "no" to "not" typo fix 2020-09-28 11:42:06 -04:00
Artem Vozhdayenko
d75dd095a3 GH-3194: Add generics to Amqp and Jms channel impls
Fixes https://github.com/spring-projects/spring-integration/issues/3194

For now we keep the hierarchy, but try to generalize channel specs
a bit, so that ones who use `publishSubscribeChannel` can count on
`BroadcastCapableChannel` as interface to utilize.
2020-09-25 14:55:10 -04:00
Artem Vozhdayenko
a8430c12a6 GH-3306: Remove setters from registration object
Fixes https://github.com/spring-projects/spring-integration/issues/3306

To prevent API misuse (one can set ID after doing a registration which
will do nothing actually), it is safer to remove set* methods from
`StandardIntegrationFlowRegistration` object.
Providing some related refactoring like making fields 'final', 
adjusting usages to keep correct behavior of the builder.
2020-09-25 14:48:52 -04:00
Artem Bilan
a62a7d1ddd INT-3045: Add in & out ZeroMq channel adapters (#3388)
* INT-3045: Add in & out ZeroMq channel adapters

JIRA: https://jira.spring.io/browse/INT-3045

* Add `ZeroMqMessageHandler` to produce messages into one-way ZeroMq sockets
* Add `ZeroMqMessageProducer` to consumer messages from one-way ZeroMq sockets
* Add `ConvertingBytesMessageMapper` impl for the `BytesMessageMapper` to
delegate an actual conversion into the provided `MessageConverter`
* Add `ZeroMqHeaders` for message headers constants representing ZeroMq message attributes
* Fix `ZeroMqChannel` for the proper deferred `zeroMqProxy` evaluation
* Add more JavaDocs
* Fix `ZeroMqChannelTests.testPubSubBind()` to be sure that really all the
subscribed channels get the same message from the `PUB` socket

* * Fix typo in the `ConvertingBytesMessageMapper`
* Add `this` for `doOnError()` in the `ZeroMqChannel` & `ZeroMqMessageProducer`
* Change the bind logic in the `ZeroMqMessageProducer` to `port` and let it to
bind to random port.
The actual port is available later via `getBoundPort()`
* Introduce a `ZeroMqMessageProducer.receiveRaw()` to let received `ZMsg` to
be produce as a `payload`
* Add a logic into `ZeroMqMessageHandler` to treat `ZMsg` in the payload of
request message as is without any conversion
* Fix race condition in the `ZeroMqMessageProducer` to destroy `consumerScheduler`
when the main `Flux` is complete

* * Add Java DSL for ZeroMq components
* Extract `ReactiveMessageHandlerSpec` for `ReactiveMessageHandler` impls
* Add debug message into `EmbeddedJsonHeadersMessageMapper` when cannot `decodeNativeFormat()`
* Make `ReactiveMongoDbMessageHandlerSpec` extending `ReactiveMessageHandlerSpec`
* Make `ZeroMqProxy` `autoStartup` by default
* Add `ZeroMqDslTests` to cover all the Java DSL for ZeroMq
* Introduce a `MimeTypeSerializer`  to serialize a `MimeType` into JSON as a plain string;
use it as extra serializer in the `JacksonJsonUtils.messagingAwareMapper()`
* Fix typo for the `AllowListTypeResolverBuilder` inner class

* * Add some docs
* Fix Checkstyle violations

* * More docs

* Fix language in Docs

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2020-09-25 13:46:01 -04:00
Artem Bilan
9d34cfd4dd Fix new Sonar smell 2020-09-25 11:21:03 -04:00
Artem Bilan
c94eaf7b52 Fix IntegrationReactiveUtils
The `Mono.doOnSuccess()` is always called for completed `MonoSink`
even if the value is `null`

* Fix `IntegrationReactiveUtils.messageSourceToFlux()` to check a
message for `null` before calling `AckUtils.autoAck()`
* Add an `logger.error()` message when `doOnError()` is invoked for that `Mono`

**Cherry-pick to 5.3.x**
2020-09-24 09:47:07 -04:00
Artem Bilan
e714310dae GH-3386: Add method signature for gateway proxy (#3387)
* GH-3386: Add method signature for gateway proxy

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

All the gateway proxy method invokers are supplied with the same
bean name inherited from the proxy.

* Add method signature for proxy method bean to fine-grain the
management for those bean in the logs, message history and metrics

* * Use `Class.getSimpleName()` instead to make gateway names less verbose
2020-09-18 15:40:32 -04:00
Spring Buildmaster
e223d341f3 [artifactory-release] Next development version 2020-09-16 17:29:48 +00:00
Spring Buildmaster
e2d5517544 [artifactory-release] Release version 5.4.0-M3 2020-09-16 17:29:43 +00:00
Artem Bilan
a36377a8d8 Upgrade to SK-2.6.1 2020-09-16 12:24:24 -04:00
Artem Bilan
be82e572f5 Upgrade dependencies; fix deprecations
* Prepare for release
2020-09-16 11:03:31 -04:00
Artem Bilan
e154067a1f GH-3376: Remove gauges on application ctx close (#3377)
* GH-3376: Remove gauges on application ctx close

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

The `MeterRegistry` may request meters on application shutdown.
The gauges for channels, handlers and message sources don't make sense
at the moment since all those beans are going to be destroyed.

* Remove gauges for channel, handler and message source numbers from the
`IntegrationManagementConfigurer.destroy()`

**Cherry-pick to 5.3.x & 5.2.x**

* * Add `MicrometerImportSelector` to conditionally load
a  `MicrometerMetricsCaptorConfiguration` when `MeterRegistry`
is on class path.
* Make `MicrometerMetricsCaptorConfiguration.integrationMicrometerMetricsCaptor()`
 bean dependant on the `ObjectProvider<MeterRegistry>`
* Make `IntegrationManagementConfiguration.managementConfigurer()`
dependant on the `ObjectProvider<MetricsCaptor>`.
This way the `IntegrationManagementConfigurer` is destroyed before
`MeterRegistry` when application context is closed
* Deprecate `MicrometerMetricsCaptor.loadCaptor()` in favor of
`@Import(MicrometerImportSelector.class)`

* * Add `MicrometerMetricsCaptorRegistrar` to register a `MICROMETER_CAPTOR_NAME`
bean when `MeterRegistry` is on class path and no `MICROMETER_CAPTOR_NAME` bean yet.
* Make `IntegrationManagementConfiguration.managementConfigurer()`
dependant on the `ObjectProvider<MetricsCaptor>`.
This way the `IntegrationManagementConfigurer` is destroyed before
`MeterRegistry` when application context is closed
* Deprecate `MicrometerMetricsCaptor.loadCaptor()` in favor of
`@Import(MicrometerMetricsCaptorRegistrar.class)`
* Fix test to make a `MeterRegistry` bean as `static` since
`@EnableIntegrationManagement` depends on this bean definition now
2020-09-16 10:32:39 -04:00
Artem Bilan
7a97eb6e1c GH-3336: Change MongoDb Store sequence to long (#3385)
* GH-3336: Change MongoDb Store sequence to long

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

Turns out there are some scenarios where too many messages
are transferred through the message store, so `int` for
sequence is not enough as a type

* Change sequence to `long` to widen a sequence lifespan

* * Change MongoDb store to deal with `Number.longValue()`
instead of casting which doesn't work from `Integer` to `Long`.
This way we can keep an old sequence document with an `int`
type for value
* Documents with new `long` type for their sequence field are OK.
The `NumberToNumberConverter` has an effect converting `int` to `long`
properly.
2020-09-15 12:55:09 -04:00
Artem Bilan
7f330850d1 GH-3372: Expose (S)FTP remoteComparator for DSL
Fixes https://github.com/spring-projects/spring-integration/issues/3372

**Cherry-pick to 5.3.x & 5.2.x**
2020-09-14 16:49:49 -04:00
Artem Bilan
ee7ebf3530 GH-3373: Support IPV6 in AbstractInboundFileSynch
Fixes https://github.com/spring-projects/spring-integration/issues/3373

The `AbstractInboundFileSynchronizer` doesn't consider that
`hostPort` from `Session` could be in an IPv6 syntax

* Parse the `hostPort` from `Session` in a manner that only the last
`:` is treated as a port delimiter

**Cherry-pick to 5.3.x & 5.2.x**
2020-09-14 16:06:51 -04:00
Artem Bilan
19b59bbde8 Upgrade to Reactor 2020.0.0-RC1
* Handle `Emission.FAIL_ZERO_SUBSCRIBER` in the
`FluxMessageChannel` and `IntegrationReactiveUtils`
2020-09-14 11:59:20 -04:00
Artem Bilan
5bac9bf66e Fix some tests race conditions
* Fix unused import in the `IntegrationRequestMappingHandlerMapping`
* Fix deprecations from Reactor
* Fix race condition in the `AbstractCorrelatingMessageHandlerTests`:
 the discard message is sent much earlier than group is removed from the store.
Iterate group count call until it pass or 10 seconds timeout
* Remove list size assert in the `FtpServerOutboundTests`: looks like
it is not updated properly even if we have an expected content in the collection
* Increase timeout to assert remote files removal in the `FtpRemoteFileTemplateTests`
2020-09-12 11:58:57 -04:00
Artem Bilan
c36314d6ec GH-3366: Document HTTP request mapping limitation (#3382)
* GH-3366: Document HTTP request mapping limitation

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

The same path cannot be mapped both Spring Integration and MVC ways

* Doc Polishing

Co-authored-by: Gary Russell <grussell@pivotal.io>
2020-09-11 16:09:01 -04:00
Gary Russell
dbb2f9cecb Revert "GH-3366: Return null from HTTP handleNoMatch"
This reverts commit 9aa9707f37.

See https://github.com/spring-projects/spring-framework/issues/25636#issuecomment-691269516
2020-09-11 15:29:16 -04:00
Artem Bilan
9aa9707f37 GH-3366: Return null from HTTP handleNoMatch
Fixes: https://github.com/spring-projects/spring-integration/issues/3366

When the same path is mapped for integration HTTP endpoint and MVC
method mapping, but different other mapping options (e.g. method)
and one of them fails to match, there is no way to try other
`RequestMapping` from the `DispatcherServlet` because
`RequestMappingHandlerMapping.handleNoMatch()` throws an exception
when no match instead of `null` according chain of responsibility logic
in the `DispatcherServlet`

*  Rework `IntegrationRequestMappingHandlerMapping.handleNoMatch()` to catch
all the super exception and return `null` to the `DispatcherServlet` to let
it to try other `RequestMapping` from the configuration
* Change an order for `IntegrationRequestMappingHandlerMapping` to `-1`
to let it to be tried first before regular MVC `RequestMappingHandlerMapping`
* Add a test-case to ensure that mix-in Integration HTTP and MVC for the
same path works as expected without failing on first try
2020-09-11 15:24:25 -04:00
Artem Bilan
09dec2eab5 Handle new Reactor Emission FAIL_NON_SERIALIZED
* Rework WebFlux test to JUnit 5
2020-09-11 14:12:09 -04:00
Artem Bilan
481d5eb2a5 Fix new Sonar smells
* Use `tryEmitNext` on Reactor `Sink` since `emitNext` is deprecated
* Add `MessageDeliveryException` emission when `send()` returns `false`
in the `FluxMessageChannel` for `subscribeTo` provided `Publisher`
2020-09-11 12:37:27 -04:00
Artem Bilan
383af8ceb9 GH-3374: Fix scan for BF propagation (#3378)
* GH-3374: Fix scan for BF propagation

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

An internal `ClassPathScanningCandidateComponentProvider` instance in the `IntegrationComponentScanRegistrar`
does not propagate a provided `registry`.

* Implement `getRegistry()` on the internal `ClassPathScanningCandidateComponentProvider` to propagate
a provided into the `registerBeanDefinitions()` a `BeanDefinitionRegistry`
* Add `@Conditional` on some scanned `@MessagingGateway` in the `EnableIntegrationTests`

**Cherry-pick to 5.3.x & 5.2.x**

* * Remove unused import

* Restore `unused` warning on the unused registry arg
2020-09-11 09:48:36 -04:00
Artem Bilan
47cae4670f GH-3370: Remove synchronized from RemoteFileUtils (#3380)
* GH-3370: Remove synchronized from RemoteFileUtils

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

The `synchronized` on the `RemoteFileUtils.makeDirectories()` makes an application too
 slow, especially when we deal with different paths in different sessions

* Remove the `synchronized` from that method and rework `SftpSession.mkdir()`
to return `false` when "A file cannot be created if it already exists" exception
is thrown from the server.
Essentially make an `exists()` call to be sure that an exception is really related
to "file-already-exists" answer from the server

**Cherry-pick to 5.3.x, 5.2.x & 4.3.x**

* * Re-throw an exception in the `SftpSession.mkdir()`
when error code is not `4` or remote dir does not exist

* * Check `session.mkdir()` result in the
`RemoteFileUtils` to throw an `IOException` when `false`

* * Fix mock test to return `true` for `mkdir` instead of `null`
2020-09-10 13:46:57 -04:00
Artem Bilan
6c2a4c97c5 More H2 for JDBC tests
* Upgrade to Spring Security 5.4.0
2020-09-10 09:41:42 -04:00
guycall
71a273eece Fix naming in Inbound Kafka Gateway code sample 2020-09-10 09:14:51 -04:00
Artem Bilan
8e7785d8b5 Some JDBC tests clean up; use H2 mostly 2020-09-09 14:18:35 -04:00
Artem Bilan
af5bcdf4d7 Honor Emission result in FluxMessageChannel
* Implement `Emission` handling in the `FluxMessageChannel` and `IntegrationReactiveUtils`
* Upgrade to Spring Kafka `2.6.0`
* Fix R2DBC components for deprecation in the Spring Data R2DBC
* Implement `StatementMapper.SelectSpec` for query expression
* Clean up for some sporadic test failures
2020-09-09 12:16:00 -04:00
Artem Bilan
e4b8b32b01 Upgrade to RSocket SNAPSHOT 2020-09-08 10:25:20 -04:00
Artem Bilan
342f8e8773 Revert to Sonar plugin 2.8 to show coverage 2020-08-28 16:04:55 -04:00
Artem Bilan
3c53a53b06 Fix Redis test to not initialize connection twice
Possible cause for: https://build.spring.io/browse/INT-MASTERSPRING40-1181
2020-08-27 10:53:18 -04:00
Artem Bilan
e5d859f1c7 Refinement for Redis Stream tests 2020-08-26 14:07:38 -04:00
Artem Bilan
52070259b3 Fix compatibility with the latest SF 2020-08-26 12:43:47 -04:00
Sergei Portnov
d95c7149c4 Fix typo in ftp.adoc 2020-08-25 11:29:21 -04:00
Michel Jung
6780bbd5c8 GH-3367: Separate timeouts in BarrierMH
Fixes https://github.com/spring-projects/spring-integration/issues/3367

Introduce a `requestTimeout` and `triggerTimeout` for `BarrierMessageHandler`
For instance, if an HTTP request sends a message to the barrier,
it should time out after 1min if no trigger message is received.
If the trigger message then arrives late and the HTTP request is no longer waiting,
it shouldn't wait for 1min before discarding the request but do so immediately.
2020-08-21 12:50:45 -04:00
Artem Bilan
3fb6567a1f Fix new Sonar smells 2020-08-21 11:37:43 -04:00
Artem Bilan
973276fc0a Fix count and update in MongoDb stores
* The `into()` query can't infer the type for entity if we provide `Object.class`
* The `updateFirst()` does not support sort queries any more - replace with `findAndModify()`
* Add `getMessageGroupCount()` into tests

**Cherry-pick to 5.3.x & 5.2.x**
2020-08-20 16:44:03 -04:00
Artem Bilan
750d721437 Fix some Sonar smells 2020-08-20 16:08:18 -04:00
Artem Bilan
8398d9c7e7 Upgrade to Kotlin 1.4 2020-08-19 16:38:32 -04:00