Service brokers are an abstraction provided by Cloud Foundry that encourages loose coupling between an application and the service instances it consumes. Service brokers negotiate the details of the relationship between an application and its services, including the service's actual location, the appropriate credentials to use when accessing it, and limits on how much of the service's resources an application can consume.
Every service broker follows a similar lifetime, involving separate actions by several different roles. Each of these actions, taken together, create the final service broker instance that application developers can consume.
Adding to the Marketplace
The Markeplace in Cloud Foundry represents the set of services that are available to be used by developers in creating applications. Developers are only able to see those services that have been configured to be visible for their targeted organization and space. This visibility is configured through the plan defined for that service by the CF administrator - plans can be public and visible to all, or private, which gives a service limited visibility.
A Cloud Foundry administrator must install a service broker into the marketplace. Services are described by their name, a brief description, and a list of the different service plans available for developers. These plans define the cost of using that service, and usually vary from free to increasingly costly and more capable plans.
Administrators install brokers into the marketplace through the cf create-service-broker
call. See Registering a Service Broker and Service Broker Plans for more details.
Creating Service Broker Instances
Before a service can be used in an application, a service broker from the marketplace has to be instantiated. This process creates a new instance of that broker, gives it a name, and constraints it to a single service plan (which describes resource availability, cost, etc).
Organization and Space Managers Service broker instances can be created with cf create-service
and available service broker instances can be seen through cf services
.
For example, for this given marketplace
PS C:\Users\ironfoundry\Desktop> cf marketplace Getting services from marketplace in org ironfoundry / space development as [email protected]
.. OK service plans description mongodb free MongoDB NoSQL database ms-sql free Microsoft SQL Server Service
we can create another service broker for ms-sql
PS C:\Users\ironfoundry\Desktop> cf create-service ms-sql free sample-instance Creating service sample-instance in org ironfoundry / space development as [email protected]
.. OK
and then view the service broker instances
PS C:\Users\ironfoundry\Desktop> cf services Getting services in org ironfoundry / space development as [email protected]
.. OK name service plan bound apps free-sql ms-sql free sample-instance ms-sql free
Binding the Service Broker to an Application
Once the service broker instance is created, developers are free to use it in their applications. This process is described in