GH-3027: Decouple RotationPolicy

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

This is a polishing for PR https://github.com/spring-projects/spring-integration/pull/3029

* Move `KeyDirectory` in to the `RotationPolicy` since it looks like fully
coupled concept with that abstraction and the class name is so bad for
the public API
* Remove `AbstractStandardRotationPolicy` in favor of a `StandardRotationPolicy`
extendability
* Change `ftp.adoc` and `sftp.adoc` to reflect a new API reality
* Mantion these changes in the `whats-new.adoc`
This commit is contained in:
Artem Bilan
2019-08-15 10:10:44 -04:00
committed by Gary Russell
parent a66b5ed6e2
commit 13a8623b59
8 changed files with 109 additions and 131 deletions

View File

@@ -706,20 +706,20 @@ Notice that, in this example, the message handler downstream of the transformer
Starting with _version 5.0.7_, the `RotatingServerAdvice` is available; when configured as a poller advice, the inbound adapters can poll multiple servers and directories.
Configure the advice and add it to the poller's advice chain as normal.
A `DelegatingSessionFactory` is used to select the server see <<ftp-dsf>> for more information.
The advice configuration consists of a list of `RotatingServerAdvice.KeyDirectory` objects.
The advice configuration consists of a list of `RotationPolicy.KeyDirectory` objects.
.Example
[source, java]
----
@Bean
public RotatingServerAdvice advice() {
List<KeyDirectory> keyDirectories = new ArrayList<>();
keyDirectories.add(new KeyDirectory("one", "foo"));
keyDirectories.add(new KeyDirectory("one", "bar"));
keyDirectories.add(new KeyDirectory("two", "baz"));
keyDirectories.add(new KeyDirectory("two", "qux"));
keyDirectories.add(new KeyDirectory("three", "fiz"));
keyDirectories.add(new KeyDirectory("three", "buz"));
List<RotationPolicy.KeyDirectory> keyDirectories = new ArrayList<>();
keyDirectories.add(new RotationPolicy.KeyDirectory("one", "foo"));
keyDirectories.add(new RotationPolicy.KeyDirectory("one", "bar"));
keyDirectories.add(new RotationPolicy.KeyDirectory("two", "baz"));
keyDirectories.add(new RotationPolicy.KeyDirectory("two", "qux"));
keyDirectories.add(new RotationPolicy.KeyDirectory("three", "fiz"));
keyDirectories.add(new RotationPolicy.KeyDirectory("three", "buz"));
return new RotatingServerAdvice(delegatingSf(), keyDirectories);
}
----
@@ -740,7 +740,7 @@ public RotatingServerAdvice advice() {
In this case, the advice will move to the next server/directory regardless of whether the previous poll returned a file.
Alternatively, you can provide your own `RotatingServerAdvice.RotationPolicy` to reconfigure the message source as needed:
Alternatively, you can provide your own `RotationPolicy` to reconfigure the message source as needed:
.policy
[source, java]

View File

@@ -705,20 +705,20 @@ Notice that, in this example, the message handler downstream of the transformer
Starting with _version 5.0.7_, the `RotatingServerAdvice` is available; when configured as a poller advice, the inbound adapters can poll multiple servers and directories.
Configure the advice and add it to the poller's advice chain as normal.
A `DelegatingSessionFactory` is used to select the server see <<./ftp.adoc#ftp-dsf,Delegating Session Factory>> for more information.
The advice configuration consists of a list of `RotatingServerAdvice.KeyDirectory` objects.
The advice configuration consists of a list of `RotationPolicy.KeyDirectory` objects.
.Example
[source, java]
----
@Bean
public RotatingServerAdvice advice() {
List<KeyDirectory> keyDirectories = new ArrayList<>();
keyDirectories.add(new KeyDirectory("one", "foo"));
keyDirectories.add(new KeyDirectory("one", "bar"));
keyDirectories.add(new KeyDirectory("two", "baz"));
keyDirectories.add(new KeyDirectory("two", "qux"));
keyDirectories.add(new KeyDirectory("three", "fiz"));
keyDirectories.add(new KeyDirectory("three", "buz"));
List<RotationPolicy.KeyDirectory> keyDirectories = new ArrayList<>();
keyDirectories.add(new RotationPolicy.KeyDirectory("one", "foo"));
keyDirectories.add(new RotationPolicy.KeyDirectory("one", "bar"));
keyDirectories.add(new RotationPolicy.KeyDirectory("two", "baz"));
keyDirectories.add(new RotationPolicy.KeyDirectory("two", "qux"));
keyDirectories.add(new RotationPolicy.KeyDirectory("three", "fiz"));
keyDirectories.add(new RotationPolicy.KeyDirectory("three", "buz"));
return new RotatingServerAdvice(delegatingSf(), keyDirectories);
}
----
@@ -739,7 +739,7 @@ public RotatingServerAdvice advice() {
In this case, the advice will move to the next server/directory regardless of whether the previous poll returned a file.
Alternatively, you can provide your own `RotatingServerAdvice.RotationPolicy` to reconfigure the message source as needed:
Alternatively, you can provide your own `RotationPolicy` to reconfigure the message source as needed:
.policy
[source, java]

View File

@@ -55,6 +55,13 @@ See <<./aggregator.adoc#flux-aggregator,Flux Aggregator>> for more information.
The FTP and SFTP modules now provide an event listener for certain Apache Mina FTP/SFTP server events.
See <<./ftp.adoc#ftp-server-events, Apache Mina FTP Server Events>> and <<./sftp.adoc#sftp-server-events, Apache Mina SFTP Server Events>> for more information.
[[x5.2-avro]]
==== Avro Transformers
Simple Apache Avro transformers are now provided.
See <<./transformers.adoc#avro-transformers, Avro Transformers>> for more information.
[[x5.2-general]]
=== General Changes
@@ -131,14 +138,14 @@ See <<./webflux.adoc#webflux,WebFlux Support>> for more information.
The `MongoDbMessageStore` can now be configured with custom converters.
See <<./mongodb.adoc#mongodb, MongoDB Support>> for more information.
[[x5.2-avro]]
==== Avro Transformers
Simple Apache Avro transformers are now provided.
See <<./transformers.adoc#avro-transformers, Avro Transformers>> for more information.
[[x5.2-routers]]
==== Router Changes
You can now disable falling back to the channel key as the channel bean name.
See <<./router.adoc#dynamic-routers, Dynamic Routers>> for more information.
[[x5.2--ftp-sftp]]
==== FTP/SFTP Changes
The `RotatingServerAdvice` is decoupled now from the `RotationPolicy` and its `StandardRotationPolicy`.
See <<./ftp.adoc#ftp-rotating-server-advice, Polling Multiple Servers and Directories>> for more information.