Commit Graph

1125 Commits

Author SHA1 Message Date
Gary Russell
e919428680 GH-3326: TCP: Support Unsolicited Server Messages
Resolves https://github.com/spring-projects/spring-integration/issues/3326

- OB Gateway - send unsolicited messages and late replies to a channel
- Support multiple `TcpSender` s

* Add channel variant to spec; code polishing
2020-07-06 15:05:57 -04:00
Alexandre Strubel
e2c6e77f2f GH-3272: Add lease renewal for distributed locks
Fixes https://github.com/spring-projects/spring-integration/issues/3272

* Introduce a `RenewableLockRegistry` since not all `LockRegistry` implementations
provide a way to renew the lease for the lock
* Implement `RenewableLockRegistry` in the `JdbcLockRegistry`
* Test and document the feature
2020-07-06 12:46:47 -04:00
Artem Bilan
146b0af1f4 GH-3320: Refine lifecycle control in StdIntFlow (#3322)
* GH-3320: Refine lifecycle control in StdIntFlow

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

Turns out that lifecycle control for the whole bunch of components
in one `IntegrationFlow` is useful in fields.

* Change the logic in the `StandardIntegrationFlow` to let to call
`start()` and `stop()` independently how the flow was registered in
the application context.
This way it can be autowired as a `Lifecycle` to let end-user to
avoid the search for proper component in the flow to stop or start
manually - all the components registered with the flow are going
to be stopped or started respectively

* * Add `this.` to class property usage to satisfy Checkstyle

Co-authored-by: Artem Bilan <abilan@vmware.com>
2020-07-02 15:29:43 -04:00
Attoumane AHAMADI
afa79d868b GH-3226: Redis Stream Outbound Channel Adapter
Fixes https://github.com/spring-projects/spring-integration/issues/3226

* Redis stream message handler support.
* This is the outbound part publishing message to the actual stream using ReactiveStreamOperations

* Addition of more test cases with one using `MessageChannel`.

* Improvements after PR review.

* Removed failed test reading List from a Stream
* Code style clean up
* Remove `rawtypes` usage
* Remove redundant inner classes for test model
* Add `What's New` note
2020-06-26 11:28:41 -04:00
Florian Schmaus
4761800528 Fix XMPP documentation
s/Enhancement Proposal/Extension Protocol/

XMPP XEPs are extension protocols of XMPP "core" (i.e., RFC 6120 and
RFC 6121).

See also https://xmpp.org/extensions/xep-0001.html:
"The focal point of the process is a series of protocol specifications
called XMPP Extension Protocols or XEPs."
2020-06-26 08:56:13 -04:00
fnu, rohan
dfd914254b INT-4566: R2DBC Outbound Channel Adapter
JIRA: https://jira.spring.io/browse/INT-4566

* Fixed review comments
* added `DELETE` and `Criteria` implementation for outbound channel adapter
* Clean up code style
* Add initial docs
2020-06-25 12:45:24 -04:00
Gary Russell
b860a2e818 Merge Spring Integration Kafka into Main Repo
- merge master branch from old repo (`git-filter-repo`) for src branch
- update build.gradle
- copy docs from Spring for Apache Kafka Chapter

Doc polishing.

Fix http: references in tests.

* Add `What's New` note and fix `polling-consumer.adoc`
not linking to external project any more
2020-06-25 11:46:38 -04:00
Artem Bilan
2419c03b25 Replace whitelist with allowlist 2020-06-15 14:20:51 -04:00
artembilan
3499cd615a Code clean up for JacksonJsonUtils
* Mention `trustedPackages` in the `redis.adoc`

**Cherry-pick to 5.3.x, 5.2.x, 5.1.x & 4.3.x**
2020-06-09 14:49:25 -04:00
Artem Bilan
ef939a09a4 GH-3283: HTTP Inbound handle SpEL errors (#3289)
* GH-3283: HTTP Inbound handle SpEL errors

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

* Process all the request message preparation exceptions
in the provided error channel to let target application
to make a decision about an appropriate HTTP status instead of
default 500 Server Error

* * Rephrase `ResponseStatusException` doc in the http.adoc

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2020-05-28 11:47:15 -04:00
Artem Bilan
b8e2dfe4e1 GH-3280: NullChannel as reply for void gateways (#3292)
* GH-3280: NullChannel as reply for void gateways

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

To properly support a one-way gateway (`void` return type), it is
better to ignore any possible replies from downstream instead of
unexpected `no output-channel or replyChannel header available`
error

* Populate a `nullChannel` into a `replyChannel` header
for `void` gateway methods when `replyChannel` is not set explicitly
* Remove redundant `GatewayProxyFactoryBean.PARSER` in favor of
similar `EXPRESSION_PARSER` in the super class
* Test and document the feature

* * Fix language in the `whats-new.adoc`

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

* * Fix language in gateway.adoc

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

Co-authored-by: Gary Russell <grussell@vmware.com>
2020-05-27 16:10:05 -04:00
Artem Bilan
8d1dd0b68d Some docs clean up 2020-05-27 12:21:24 -04:00
Artem Bilan
8ba27f6e60 Move 5.3 changes to history 2020-05-26 16:54:15 -04:00
Yury Kartsev
6bd5ca4cbe Fix XML examples in handler-advice reference doc
1. Add proper terminating tags for `request-handler-advice-chain`.
2. Replace `int:request-handler-advice-chain` with `int-http:request-handler-advice-chain` when used inside of an `int-http:outbound-gateway`.
3. Replace `<bean ref="*" />` with `<ref bean="*" />`
4. Replace `</int:int:service-activator>` with `</int:service-activator>`
2020-05-13 12:16:13 -04:00
Yury Kartsev
aa26d2fc64 Fix typo in reference manual
Fix typo in reference manual for transaction support.
2020-05-11 20:52:05 -04:00
Artem Bilan
f047f0528b Fix Checkstyle to rely on the absolute path
It turns out that relative path in the property
`<property name="file" value="src/checkstyle/checkstyle-suppressions.xml"/>`
in some cases is resolved against a Gradle deamon dir as a root for configs

* Fix Checkstyle plugin config to use an absolute path in the project for
the `configDirectory`.
* Since `configDirectory` is exposed as a Checkstyle config variable,
we can use its `${config_loc}` placeholder to rely on the absolute path
in the project
2020-05-06 15:53:28 -04:00
Artem Bilan
9ec6529992 Upgrade to Rsocket 1.0-RC7; fix deprecations
* Fix RSocket docs according new functionality

**Cherry-pick to 5.2.x**
2020-04-28 17:20:38 -04:00
Artem Bilan
2d9a5f60f4 Introduce a ReceiveMessageAdvice (#3265)
* Introduce a `ReceiveMessageAdvice`

* Deprecate an `AbstractMessageSourceAdvice` in favor of
`default` method in the `MessageSourceMutator`
* Move a `applyReceiveOnlyAdviceChain()` logic into the `AbstractPollingEndpoint`:
now both `PollingConsumer` and `SourcePollingChannelAdapter` can use
`ReceiveMessageAdvice`
* Introduce a `SimpleActiveIdleReceiveMessageAdvice` based already
on the `ReceiveMessageAdvice` and deprecate a `SimpleActiveIdleMessageSourceAdvice`
which is fully replaceable with newly introduced `SimpleActiveIdleReceiveMessageAdvice`
* Add `@SuppressWarnings("deprecation")` for those out-of-the-box `ReceiveMessageAdvice`
implementation which still use an `AbstractMessageSourceAdvice` for
backward compatibility
* Document a new feature and give the `MessageSourceMutator` a new meaning

* * Fix language in the `polling-consumer.adoc`
2020-04-28 13:03:30 -04:00
Artem Bilan
cfd03f89a0 Use a SimpleJsonSerializer in the FileSplitter (#3262)
* Use a SimpleJsonSerializer in the FileSplitter

* To avoid extra dependency for Jackson when we
serialize `FileSplitter.FileMarker` to JSON, use
a `SimpleJsonSerializer` instead.
* Fix `SimpleJsonSerializer` to escape a `\` symbol from property values
since it is used for quoting string values in the final JSON

* * Document the change
2020-04-27 15:42:45 -04:00
Jay Bryant
620b9bf52d Upgrade to latest version of Asciidoctor
Upgrade to latest version of Asciidoctor because we were several
versions behind and were steadily incurring more technical debt.

* Replace project-version attribute in Asciidoctor

I had removed the project-version attribute, but the docs use it all
over, so I put it back.

* Removed unneeded repositories

It turns out that those repositories are not needed.

A cross-reference was incorrectly formatted (missing the # character).
2020-04-27 12:37:53 -04:00
Gary Russell
1d4626f54c GH-3256: Support Testing TCP Connections
Resolves https://github.com/spring-projects/spring-integration/issues/3256
2020-04-23 17:04:29 -04:00
Artem Bilan
02407f7dff Add ReactiveMessageSourceProducer (#3254)
* Add `ReactiveMessageSourceProducer`

The `ReactiveMessageSourceProducer` wraps a provided `MessageSource`
into a `Flux` for subscription in the `subscribeToPublisher(Publisher<? extends Message<?>>)`
to make a source polling feature fully based on a reactive, on demand solution

* Introduce a `IntegrationReactiveUtils` replacing existing `MessageChannelReactiveUtils`
with more functionality
* Replace a deprecated `MessageChannelReactiveUtils` with a new `IntegrationReactiveUtils`
* Test and document the feature

* * Fix Docs typos

* * Remove unused imports from `MessageChannelReactiveUtils`

* * Fix JavaDoc copy/paste artifact
2020-04-23 15:28:16 -04:00
Gary Russell
c2babe4ba2 Add remaining deprecations for legacy metrics
- add a module to suppress legacy metrics from the Integration Graph
- move graph tests package to match src/main

Fix missed deprecation and checkstyle.

More deprecations and remove GraphLegacyStatsNullModule.

* Revert GRAPH_VERSION.
* Fix JavaDocs warnings
* Fix `MBeanExporterParserTests`
2020-04-22 17:29:36 -04:00
Artem Bilan
0d9b421cc9 Apply GitHub default community health
* Remove `CODE_OF_CONDUCT.adoc` if favor of the same for a GitHub org
* Move `LICENSE.txt` to the root project dir
* Fix `build.gradle` to copy a `LICENSE.txt` from the actual location
* Fix `README.md` and `CONTRIBUTING.adoc` to point into the actual `CODE_OF_CONDUCT`
& Security policy
* Add `ISSUE_TEMPLATE` directory with files similar to ones in `spring-session`
* Fix wrong section `id` in the `whats-new.adoc`
2020-04-18 16:55:53 -04:00
Artem Bilan
47d7bf3fe2 Add missed doc contents entry for RSocket chapter
**Cherry-pick to 5.2.x**
2020-04-14 16:37:29 -04:00
Artem Bilan
b75f1bd0da GH-3247: Fix SftpSession.exists for error code (#3248)
* GH-3247: Fix `SftpSession.exists` for error code

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

When there is no path on the SFTP server, a `ChannelSftp.SSH_FX_NO_SUCH_FILE`
error is returned in the thrown `SftpException`.

* Fix `SftpSession.exists()` to check for the `SSH_FX_NO_SUCH_FILE` to
return `false` and re-throw an exception otherwise
* Add mock test for `SftpSession.exists()`
* Add `org.mockito.AdditionalMatchers` to `checkstyle.xml` exclusions

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

* * Add exists tests against Mina embedded server
2020-04-14 15:26:14 -04:00
Artem Bilan
d8c378bd28 GH-2788: Add MongoDbChangeStreamMessageProducer
Fixes https://github.com/spring-projects/spring-integration/issues/2788

* Introduce a `MessageProducerSupport.subscribeToPublisher(Publisher<Message<?>>)`
for components which produces `Flux` for data from their source
* Such a component is auto-stopped when subscription to that `Publisher` is canceled
* Implement a `MongoDbChangeStreamMessageProducer` based on the reactive support for
in Spring Data MongoDb
* Implement a Java DSL for `MongoDbChangeStreamMessageProducer`
* Disable a test for change stream since it requires server of version 4.x started with 'replSet' option
* Add `MongoHeaders` for change stream events

* Change `MessageProducerSupport` to use a `takeWhile((message) -> isRunning())`
instead of storing a `subscription` from a callback
* Document new features

* Remove trailing whitespaces

* Doc Polishing.
2020-04-07 16:51:55 -04:00
Gary Russell
7d7c273515 GH-3241: MetadataStoreSelector - compare old/new (#3242)
Resolves: https://github.com/spring-projects/spring-integration/issues/3241

 * Docs and XML namespace support.
2020-04-06 18:12:36 -04:00
Gary Russell
5cb3f21d41 GH-2736: Async Mode for TcpOutboundGateway
Resolves https://github.com/spring-projects/spring-integration/issues/2736

Support asynchronous request/reply.

* - Add `async` to the schema
- Fix tests1

* - Capture `isAsync` in a variable
- Fix typo
- Convert test to JUnit5
2020-04-01 17:43:29 -04:00
Artem Bilan
76e79012fe GH-3219: Add HandleMessageAdviceAdapter (#3234)
* GH-3219: Add `HandleMessageAdviceAdapter`

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

* * Fix language in doc

Co-Authored-By: Gary Russell <grussell@pivotal.io>

Co-authored-by: Gary Russell <grussell@pivotal.io>
2020-04-01 11:10:33 -04:00
Artem Bilan
7433e41036 Add more Kotlin DSL for sub-flows (#3233)
* Add more Kotlin DSL for sub-flows

* Introduce `KotlinSplitterEndpointSpec`, `KotlinEnricherSpec` &
`KotlinFilterEndpointSpec` to avoid an explicit use of `IntegrationFlow` usage
from Kotlin DSL
* Fix `AbstractKotlinRouterSpec` to extend `ConsumerEndpointSpec` for access
to more endpoint options as it is with Java DSL for similar specs
* Introduce a `KotlinIntegrationFlowDefinition.publishSubscribe()`
for a `BroadcastCapableChannel` and `vararg` of `KotlinIntegrationFlowDefinition` builders.
This allows us to not introduce a `BroadcastPublishSubscribeSpec` wrapper for Kotlin
and let us to remove `publishSubscribeChannel()` DSL methods for `PublishSubscribeSpec`
since it is covered with the `publishSubscribe(PublishSubscribeChannel())` and
respective set of sub-flows in Kotlin DSL as subscribers
* Use new Kotlin specs in the `KotlinIntegrationFlowDefinition` instead of their
Java variants

* * Mention `kotlin-dsl.adoc` in the ToC
2020-04-01 11:06:54 -04:00
Artem Bilan
6d5690fd58 GH-2996: Add Resource for remote file transfer (#3231)
* GH-2996: Add Resource for remote file transfer

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

* Fix `RemoteFileTemplate.send()` to support a `Resource` payload
for remote file transferring content
* Code style clean up for `RemoteFileTemplate`
* Remove `volatile` for configuration properties for better performance
* Change a `charset` to the `Charset` for only once conversion from string
during configuration phase
* Fix (S)FTP tests for new functionality
* Change affected tests to JUnit 5
* Document a new feature; mention all the supported types and `FileExistsMode` constants

* * Fix language in `whats-new.adoc`
2020-03-31 16:09:07 -04:00
Artem Bilan
9c46b3420e Fix JsonToObjectTransformer for ClassNotFoundEx (#3228)
* Fix JsonToObjectTransformer for ClassNotFoundEx

Related to https://github.com/spring-projects/spring-integration/issues/3223

The `JsonToObjectTransformer` consults `JsonHeaders` first and tries to build
a `ResolvableType` from other type headers which may be just a string identifications.
In this case a `ClassNotFoundException` could be thrown if a `ResolvableType` cannot
be build against non-class identificators

* Add `valueTypeExpression` option to the `JsonToObjectTransformer` to let to
build a `ResolvableType` using any possible custom logic, e.g. resolving
target classes from some registry using their ids from the mentioned headers

**Cherry-pick to 5.2.x**

* * Fix English language mistakes
2020-03-27 15:42:24 -04:00
Artem Bilan
f1a0a066af Fix some typos in amqp.adoc 2020-03-26 14:09:43 -04:00
Gary Russell
fbf06e8bb5 GH-3181: MQTT: Support MANUAL Acks
Resolves https://github.com/spring-projects/spring-integration/issues/3181

* Doc polishing

* Rework acknowledgment into the existing `AcknowledgmentCallback`.

* Fix javadocs and doc linFix javadocs and doc linkk

* Doc polishing; explain uses of `ACKNOWLEDGMENT_CALLBACK` header.
2020-03-19 15:20:13 -04:00
Artem Bilan
3eedda6c9d GH- 3223: Build ResolvableType after mapping
Fixes https://github.com/spring-projects/spring-integration/issues/3223

The `json__TypeId__` header may have a value which cannot be resolved to the `Class` in the current classpath
So, skip `ResolvableType` building logic until we really sure that end-user wants to map JSON headers
* WARN a build exception that we can't load a class for the `json__TypeId__` when we try to build a `ResolvableType`
in the  `DefaultAmqpHeaderMapper`
* Document the negation feature for JSON headers

**Cherry-pick to 5.2.x**
2020-03-19 14:51:32 -04:00
Gary Russell
eea29e729a GH-3215: MQTT Event for failed connection outbound
Resolves https://github.com/spring-projects/spring-integration/issues/3215

* Add docs; publish an event for an initial connection failure too.

**Cherry-pick to 5.2.x**
2020-03-17 15:09:22 -04:00
Zach Shutters
71e6b27b41 GH-3216: Fix doc for outbound file adapter
Fixes https://github.com/spring-projects/spring-integration/issues/3216
2020-03-16 13:28:23 -04:00
Artem Bilan
46cf5db78a GH-3213: Expose LeaderInitiatorFB.candidate
Fixes https://github.com/spring-projects/spring-integration/issues/3213

* Expose a `LeaderInitiatorFactoryBean.setCandidate()` for better control over candidate options
* Expose a `candidate` attribute for the `<int-zk:leader-listener>` tag
* Fix `dokka` task to obtain `package-list` URL from the local dir
* Migrate ZK tests to JUnit 5
2020-03-11 16:07:17 -04:00
Artem Bilan
e9a3580ef5 Upgrade dependencies; fix new Sonar smells 2020-03-11 10:22:51 -04:00
Artem Bilan
6b82681cc0 GH-3211: Add DefSftpSF.setKnownHosts(Resource) (#3212)
* GH-3211: Add DefSftpSF.setKnownHosts(Resource)

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

* Add `DefaultSftpSessionFactory.setKnownHosts(Resource)` to
allow to configure externally any resource for file with known_hosts content
* Deprecate an existing method in favor of new one
* The new method makes it aligned with the `setPrivateKey(Resource)`
* Fix tests do not use a deprecated method any more

**Cherry-pick to 5.2.x**

* * Rename to `setKnownHostsResource()` to avoid XML parser confusion
* Change `sftp.adoc` to reflect a new property
2020-03-10 16:50:00 -04:00
Artem Bilan
36f96ec2c6 Document Kotlin DSL (#3210)
* Document Kotlin DSL

* Remove unused imports in `FunctionsTests.kt`

* * Fix typos in Docs
2020-03-10 16:47:41 -04:00
Artem Bilan
c45cc66a84 GH-3207: RSocket inbound: decode each flux item (#3208)
* GH-3207: RSocket inbound: decode each flux item

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

Previously an incoming RSocket Publisher has been decoded as a single unit
leading to extra work on the client side, e.g. a delimiter has to be provided
to treat each payload item as independent

* To have a consistency with Spring Messaging and its `PayloadMethodArgumentResolver`
change an `RSocketInboundGateway` to process inbound payloads as `Flux` and decode
each item independently.
* Change `RSocketDslTests` to remove delimiters and make it consistent with the regular
`RSocketRequester` client

* * Add `decodeFluxAsUnit` option into `RSocketInboundGateway`
* Document the change
2020-03-10 16:07:01 -04:00
Artem Bilan
1511dd8748 GH-3204: Add DSL intercept() operator
Fixes https://github.com/spring-projects/spring-integration/issues/3204

* Add an `intercept(ChannelInterceptor...)` method into `BaseIntegrationFlowDefinition` 
to register one or more channel interceptors at the current flow position.
* refactor to reuse `InterceptableChannel` creation from `wireTap`
* document the new operator
2020-03-05 16:15:52 -05:00
Gary Russell
c84d264294 GH-3183: Add ReactiveRequestHandlerAdvice (#3197)
* GH-3183: Add ReactiveRequestHandlerAdvice

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

* Introduce a `ReactiveRequestHandlerAdvice` with a `BiFunction<Message<?>, Mono<?>, Publisher<?>>`
logic to apply a `Mono.transform()` operator for a returned from the handler `Mono` reply
* Fix `WebFluxRequestExecutingMessageHandler` to return a `Mono.then()` instead of an explicit subscription -
it happens downstream anyway during reply producing with a proper error handling, too
* Demonstrate `ReactiveRequestHandlerAdvice` in the `RSocketDslTests` - without `retry()` it fails
* Add `ConsumerEndpointSpec.customizeMonoReply()` for convenience
* Document `ReactiveRequestHandlerAdvice` feature

* * Fix language in docs
2020-03-05 13:37:54 -05:00
Gary Russell
0efcf2402a GH-3199: Missing What's new commit 2020-03-03 16:52:12 -05:00
Artem Bilan
45a91b25de Add Reactive TX Manager support (#3201)
* Add Reactive TX Manager support

* Change `TransactionInterceptorBuilder` and `TransactionHandleMessageAdvice` to reply
on a generic `TransactionManager`, so we can configure reactive one as well
* Change a `<transactional>` XML element to support a generic `TransactionManager` reference,
so we can configure reactive one as well
* Support `adviceChain` configuration for the `ReactiveMessageHandler` in the `ConsumerEndpointFactoryBean`
* Attemp to apply reactive transaction for the Reactive MongoDB channel adapter

* * Revert `MongoDbTests` change -
to support transactions we need the latest MongoDb server with replica enabled
* Document reactive transactions

* * Address PR reviews
2020-03-03 11:54:29 -05:00
Gary Russell
cdbaf18664 GH-3199: TCP FailoverClientCF fail back default
Resolves https://github.com/spring-projects/spring-integration/issues/3199

- change the default behavior to not fail back until the current connection fails
- reduce method complexity (Sonar)
- 5.3 only
2020-03-02 14:45:09 -05:00
Gary Russell
e2b63bed7c GH-3199: Fix typo; move capture of creation time 2020-02-28 16:39:41 -05:00
Gary Russell
4180e01e59 GH-3199: FailoverClientCF - Fail Back Option
Resolves: https://github.com/spring-projects/spring-integration/issues/3199

Previously, the FCCF did not cache a shared connection; if server 1 is down
and server 2 is up, this caused an attempt to connect to server 1 every time
we got the connection.

Add 2 options: `refreshSharedInterval` and `closeOnRefresh`, defaulting to
0 and false respectively, to maintain the same behavior as before the options
existed.

Disallow caching of the single shared connection if the delegate factories are
`CachingClientConnectionFactory` instances.

**cherry-pick to 5.2.x**

I will backport to 5.1.x, 4.3.x after review/merge.

* Polish javadocs and fix typo in docs
2020-02-28 15:52:16 -05:00