Advertising Services

The {osbspec}#catalog-management[service broker catalog] provides a set of metadata describing the available services along with attributes such as cost and capabilities. The catalog is made available to the platform’s services marketplace via the service broker /v2/catalog endpoint.

The service broker can either provide a Spring bean of type {scosb-api}/org/springframework/cloud/servicebroker/model/catalog/Catalog.html[Catalog] or implement the service {scosb-api-services}CatalogService.html[CatalogService].

Providing a Catalog Bean

The service broker catalog can be exposed by creating a Spring bean and contribute it to the Spring application context. This can be done in a Spring @Configuration class as in this example:

Unresolved directive in service-catalog.adoc - include::{examples-dir}/ExampleCatalogConfiguration.java[]

Providing a Catalog Using Properties

A catalog may be configured with Spring Boot externalized configuration within a Java properties file or YAML file. The catalog is parsed and made available as a Catalog bean during auto-configuration.

Unresolved directive in service-catalog.adoc - include::{examples-dir}/catalog-minimal.yml[]
Unresolved directive in service-catalog.adoc - include::{examples-dir}/catalog-minimal.properties[]

Implementing a Catalog Service

A service broker can take more control over the catalog by implementing the CatalogService interface. This might be required if some details of the catalog metadata need to be read from the environment or from an external data source.

Unresolved directive in service-catalog.adoc - include::{examples-dir}/ExampleCatalogService.java[]