Binding to Solace PubSub+ Service Instances

This topic describes how developers can bind an app to instances of the Solace PubSub+ service.

About Bindings

For an app deployed in VMware Tanzu to obtain credentials for a Solace PubSub+ service instance, a developer needs to bind the app to the service instance.

Binding the app to a service instance produces Solace PubSub+ Credentials, which become available in the VCAP_SERVICES environment variable for the app as deployed in VMware Tanzu.

Unbinding the app from the service instance revokes the credentials.

The following procedures assume you have created a Solace PubSub+ service called solace-pubsub-instance as discussed in Service Instances and that you have a deployed app called web-backend.

The procedures show you how to bind this service instance to the app named web-backend.

Binding with Service Specific Parameters

A binding may be customized at creation time with service-specific parameters.

username: When this key is provided, the binding will its value as the client-username in the Message VPN backing the service instance. This will allow a new application to bind to an existing service and access the resources that are already owned by the given username in the service instance.

Bind a Service Instance with the cf CLI

To bind an instance of the Solace PubSub+ service with the cf Command Line Interface (CLI) tool, do the following:

  1. Set your API endpoint to the Cloud Controller of your deployment.

    $ cf api api.YOUR-SYSTEM-DOMAIN
    Setting api endpoint to api.YOUR-SYSTEM-DOMAIN...OK
    API endpoint:  https://api.YOUR-SYSTEM-DOMAIN (API version: 2.59.0)
    Not logged in. Use 'cf login' to log in.
    
  2. Log in to your deployment and select an org and a space.

    $ cf login
    API endpoint: https://api.YOUR-SYSTEM-DOMAIN
    Email> user@example.com
    Password>
    
  3. Locate the previously created service.

    $ cf services
    Getting services in org example / space dev as user@example.com...OK
    
    name                        service            plan                 bound apps   last operation
    solace-pubsub-instance      solace-pubsub      enterprise-large-ha               create succeeded
    
  4. Bind the instance to an app called web-backend.

    $ cf bind-service web-backend solace-pubsub-instance
    Binding service solace-pubsub-instance to app web-backend in org example / space development as user@example.com...OK
    TIP: Use 'cf restage web-backend to ensure your env variable changes take effect
    
  5. Restage the app for the binding to take effect.

    $ cf restage web-backend
    

Bind a Service Instance with the cf CLI with Service-Specific Parameters

To bind an instance of the Solace PubSub+ service with the cf Command Line Interface (CLI) tool with an added service-specific parameter to choose a username, do the following:

  1. Set your API endpoint to the Cloud Controller of your deployment.

    $ cf api api.YOUR-SYSTEM-DOMAIN
    Setting api endpoint to api.YOUR-SYSTEM-DOMAIN...OK
    API endpoint:  https://api.YOUR-SYSTEM-DOMAIN (API version: 2.59.0)
    Not logged in. Use 'cf login' to log in.
    
  2. Log in to your deployment and select an org and a space.

    $ cf login
    API endpoint: https://api.YOUR-SYSTEM-DOMAIN
    Email> user@example.com
    Password>
    
  3. Locate the previously created service.

    $ cf services
    Getting services in org example / space dev as user@example.com...OK
    
    name                        service            plan                 bound apps   last operation
    solace-pubsub-instance      solace-pubsub      enterprise-large-ha               create succeeded
    
  4. Bind the instance to an app called web-backend with a service-specific parameter username parameter.

    $ cf bind-service web-backend solace-pubsub-instance -c '{ "username" : "customName" }'
    Binding service solace-pubsub-instance to app web-backend in org example / space development as user@example.com...OK
    TIP: Use 'cf restage web-backend to ensure your env variable changes take effect
    
  5. Restage the app for the binding to take effect.

    $ cf restage web-backend
    

Bind a Service Instance in Apps Manager

To bind an instance of the Solace PubSub+ service in Apps Manager, do the following:

  1. Navigate to apps.YOUR-SYSTEM-DOMAIN in a browser and log in.

  2. Select the org and space in which you wish to create the Solace PubSub+ service.

  3. Click Apps, click the app name web-backend, click Services, then click Bind a Service.

    alt-text=""

  4. Select a service instance to bind to the app and click Bind.

    alt-text=""

  5. After the service is bound, you can find it listed under Services.

    alt-text=""

Unbind a Service Instance with the cf CLI

Unbinding an app from a service instance revokes previously allocated credentials. Then the app no longer has access to this service. When the binding-linked credentials are being removed, an orphaned resource policy is checked and applied. For more information about orphaned resource policies, see Default Orphaned Resource Policy and Service Orphaned Resource Policy.

To unbind an instance of the Solace PubSub+ service with the cf Command Line Interface (CLI) tool,do the following:

  1. Set your API endpoint to the Cloud Controller of your deployment.

    $ cf api api.YOUR-SYSTEM-DOMAIN
    Setting api endpoint to api.YOUR-SYSTEM-DOMAIN...OK
    API endpoint:  https://api.YOUR-SYSTEM-DOMAIN (API version: 2.59.0)
    Not logged in. Use 'cf login' to log in.
    
  2. Log in to your deployment and select an org and a space.

    $ cf login
    API endpoint: https://api.YOUR-SYSTEM-DOMAIN
    Email> user@example.com
    Password>
    
  3. Locate the previously created service.

    $ cf services
    Getting services in org example / space dev as user@example.com...OK
    
    name                        service            plan                 bound apps   last operation
    solace-pubsub-instance      solace-pubsub      enterprise-large-ha  web-backend  create succeeded
    
  4. Unbind the instance from the app called web-backend.

    $ cf unbind-service web-backend solace-pubsub-instance
    Unbinding service solace-pubsub-instance from app web-backend in org example / space development as user@example.com...OK
    TIP: Use 'cf restage web-backend to ensure your env variable changes take effect
    
  5. Restage the app for the binding to take effect.

    $ cf restage web-backend
    
Create a pull request or raise an issue on the source for this page in GitHub