Files
spring-functions-catalog/supplier/spring-http-supplier

= HTTP Supplier

This module provides an HTTP supplier that can be reused and composed in other applications.
The `Supplier` uses the `WebFluxInboundEndpoint` from Spring Integration.
`httpSupplier` is implemented as a `java.util.function.Supplier`.
This supplier gives you a reactive stream from the http endpoint. The supplier has a signature of `Supplier<Flux<Message<byte[]>>>`.
Users have to subscribe to this `Flux` and then receive the data.

== Beans for injection

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

`httpSupplier`

You need to inject this as `Supplier<Flux<Message<byte[]>>>`.

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

Once injected, you can use the `get` method of the `Supplier` to invoke it and then subscribe to the returned `Flux`.

== Configuration Options

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

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

The `HeaderMapper<HttpHeaders>` bean can be provided in the target configuration to override a default one in the `HttpSupplierConfiguration`.

== Tests

See this link:src/test/java/org/springframework/cloud/fn/supplier/http/HttpSupplierApplicationTests.java[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/http-source/README.adoc[README] where this supplier is used to create a Spring Cloud Stream application where it makes an HTTP Source.