= JDBC Supplier

This module provides a JDBC supplier that can be reused and composed in other applications.
The `Supplier` uses the `JdbcPollingChannelAdapter` from Spring Integration.
`JdbcSupplier` is implemented as a `java.util.function.Supplier`.
When you have use-cases such as periodical execution of a Database query, based on some external trigger such as a REST endpoint call for example, then you can use this `Supplier` to query the underlying relational database.

== Beans for injection

The `JdbcSupplierConfiguration` auto-configuration provides the following bean:

`jdbcSupplier`

You can inject it as `Supplier<Message<?>` when you are not splitting the rows.
If you are splitting the output, you need to inject this as `Supplier<Flux<Message<?>>>`.

You can use `jdbcSupplier` as a qualifier when injecting.

Once injected, you can use the `get` method of the `Supplier` to invoke it.
In the case of splitting you get a `Flux` which you have to subscribe in your applications.

== Configuration Options

All configuration properties are prefixed with `jdbc.supplier`.

For more information on the various options available, please see link:src/main/java/org/springframework/cloud/fn/supplier/jdbc/JdbcSupplierProperties.java[JdbcSupplierProperties]

A `ComponentCustomizer<JdbcPollingChannelAdapter>` bean can be added in the target project to provide any custom options for the `JdbcPollingChannelAdapter` configuration used by the `jdbcSupplier`.

== Tests

See this link:src/test/java/org/springframework/cloud/fn/supplier/jdbc[test suite] for the various ways, this supplier is used.

== Other usage

See this https://github.com/spring-cloud/stream-applications/blob/master/applications/source/jdbc-source/README.adoc[README] where this supplier is used to create a Spring Cloud Stream application where it makes a JDBC Source.
