7 Commits

Author SHA1 Message Date
Artem Bilan
3ebce8858f GH-107: Make Splitter Function as Flux-based
Fixes: https://github.com/spring-cloud/spring-functions-catalog/issues/107

When we have a composition like this:

```
spring.cloud.function.definition = fileSupplier|splitterFunction
```

Then final "function" signature is like this `Supplier<Flux<Message<List<Message<?>>>>>`.
And that is exactly what we don't expected from the splitter in the end of the composition.
While Spring Cloud Stream supports de-batching, it works for a `List` output only if function is bound by itself.
In case of composition we got just a `Supplier`.

* Rework `SplitterFunctionConfiguration` for `splitterFunction` from `Function<Message<?>, List<Message<?>>>`
to `Function<Flux<Message<?>>, Flux<Message<?>>>` signature to support every possible simple and composed bindings
in Spring Cloud Stream
* Rework `SplitterFunctionApplicationTests` for new expected `Function<Flux<Message<?>>, Flux<Message<?>>>` signature
* Rework `zip-split-rabbit-binder` sample to not use a `flattenFunction` workaround
and fully rely on whatever is new for the `splitterFunction`
* Fix `ZipSplitRabbitBinderApplicationTests` moving the `@RabbitListener` into a `@TestConfiguration`.
Apparently in a new Spring Boot version the test class is registered as a bean much later than normal application context startup.
Therefore, even if the `@RabbitListener` parsed and registered properly, the `RabbitAdmin` bean
has been already started to see our extra bean definition for the `@QueueBinding`

Changing signature for the splitterFunction to reactive types would make it working even with a Supplier composition.

Fix JDBC & MongoDB suppliers to deal with a new version of Splitter function

Fix Checkstyle violations

Use `IntegrationReactiveUtils.messageSourceToFlux()` API

The `IntegrationReactiveUtils.messageSourceToFlux()` provides convenient API to represent a `MessageSource`
as a `Flux` to poll this source.
The API has an error handling logic and delay when no data emitted by the source

* Remove `org.springframework.cloud` dependencies from the project
since we don't use `@PollableBean` anymore, which comes from the `spring-cloud-function-context`
* Simplify `JdbcSupplierConfiguration` and `MongodbSupplierConfiguration` code more: more injections to the respective bean method.
* Use `(__) ->` lambda syntax for unused argument
* Remove unused `ThreadLocalFluxSinkMessageChannel` internal class
* Update Copyrights of the classes in this change

Upgrade to Gradle `8.12`
2025-01-16 17:15:41 -05:00
Artem Bilan
58ffb22fff GH-106: Fix SplitterFunctionConfiguration for ambiguity on auto-wiring
Fixes: https://github.com/spring-cloud/spring-functions-catalog/issues/106

The `AbstractMessageSplitter messageSplitter` injection is too wide,
and if target application has its own splitter bean, it becomes as a candidate.
Since `SplitterFunctionConfiguration` expects only its own beans, rework the logic for `@Qualifier`
and `Optional` to be explicit for expected beans from the `SplitterFunctionConfiguration`.
2024-12-06 13:24:00 -05:00
Artem Bilan
77112eb8a1 Clean up README files, fix typos and broken links 2024-03-20 15:57:35 -04:00
Artem Bilan
0f9065df78 GH-21: Fix README for splitter-function
Fixes #21

* Change the copy/paste artifact with `header enricher` to `splitter`
2024-01-10 09:02:56 -05:00
Artem Bilan
8ef105b9c5 Make Mongo & JDBC modules as auto-config
* Also make a `spring-splitter-function` as an auto-config since it used in Mongo & JDBC suppliers
* Fix all their Checkstyle violations
2024-01-09 13:10:18 -05:00
Chris Bono
836708f0f2 GH-7: Add checkstyle and javaformat plugins
Fixes: #7

* Run `./gradlew format`
* Updates from PR review suggestions
2024-01-03 10:40:42 -05:00
Chris Bono
84e732da08 Prefix function names with spring-
* Add `spring-` prefix to function names

Fixes: #9

This commit renames each sub-module in the common, consumer, function
and supplier groups with a prefix of `spring-`.

* Update README.adoc links to new prefixed names
2024-01-02 14:07:00 -05:00