The Cloud Foundry Connector is part of the Spring Cloud Connectors project.

This connector discovers services that are bound to an application running in Cloud Foundry. (Since Cloud Foundry enumerates each service in a consistent format, Spring Cloud Connectors does not care which service provider is providing it.)

Cloud Detection

This connector checks for the presence of a VCAP_APPLICATION environment variable. This is a system-provided environment variable which is specific to Cloud Foundry. If the variable exists, the connector will be activated.

Service Detection

The connector inspects Cloud Foundry’s VCAP_SERVICES environment variable to detect available services. This variable stores connection and identification information for service instances that are bound to Cloud Foundry applications.

Below is an example of a VCAP_SERVICES entry (edited for brevity).

"p-rabbitmq": [
 {
  "credentials": {
   "http_api_uri": "https://ca30db57-a396:[email protected]:12345/api",
   "http_api_uris": [
    "https://ca30db57-a396:[email protected]:12345/api"
   ],
   "uri": "amqp://ca30db57-a396:[email protected]/322e7782-eb1f",
   "uris": [
    "amqp://ca30db57-a396:[email protected]/322e7782-eb1f"
   ]
  },
  "label": "p-rabbitmq",
  "name": "rabbit-bus",
  "plan": "standard",
  "tags": [
   "rabbitmq"
  ]
 }
]

For most supported services, the connector will consider the following fields:

tags

Attributes or names of backing technologies behind the service.

label

The service offering’s name (not to be confused with a service instance’s name).

credentials.uri

A URI pertaining to the service instance.

If they are present, it will also consider the following fields:

credentials.jdbcUrl

A JDBC connection string.

credentials.${SCHEME}${URL}

A service URL, where ${SCHEME} is a URI scheme used by the service and ${URL} is one of Url, url, Uri, and uri.

Supported Services

This connector comes with built-in support for a variety of service types and providers. The criteria by which it establishes availability of each service are described below.

Application monitoring (New Relic)

The connector will check for:

  • tags including monitoring or newrelic

  • label beginning with the monitoring or newrelic tags

Cassandra

The connector will check for:

  • cqlsh_port and node_ips fields in credentials

DB2

The connector will check for:

  • tags including sqldb, dashDB, or db2

  • label beginning with the sqldb, dashDB, or db2 tags

  • uri using the scheme db2

  • jdbcUrl using the subprotocol db2 in the JDBC URL

  • db2Uri, db2uri, db2Url, or db2url fields in credentials

MongoDB

The connector will check for:

  • tags including mongodb

  • label beginning with the mongodb tag

  • uri using the scheme mongodb

  • mongodbUri, mongodburi, mongodbUrl, or mongodburl fields in credentials

MySQL

The connector will check for:

  • tags including mysql

  • label beginning with the mysql tag

  • uri using the scheme mysql

  • jdbcUrl using the subprotocol mysql in the JDBC URL

  • mysqlUri, mysqluri, mysqlUrl, or mysqlurl fields in credentials

Oracle

The connector will check for:

  • uri using the scheme oracle

  • jdbcUrl using the subprotocol oracle in the JDBC URL

  • oracleUri, oracleuri, oracleUrl, or oracleurl fields in credentials

PostgreSQL

The connector will check for:

  • tags including postgresql

  • label beginning with the postgresql tag

  • uri using the scheme postgres

  • jdbcUrl using the subprotocol postgres in the JDBC URL

  • postgresUri, postgresuri, postgresUrl, or postgresurl fields in credentials

RabbitMQ

The connector will check for:

  • tags including rabbitmq

  • label beginning with the rabbitmq tag

  • uri or uris using the scheme amqp or amqps

  • amqpUri, amqpuri, amqpsUri, amqpsuri, amqpUrl, amqpurl, amqpsUrl, or amqpsurl fields in credentials

Redis

The connector will check for:

  • tags including redis

  • label beginning with the redis tag

  • uri using the scheme redis

  • redisUri, redisuri, redisUrl, or redisurl fields in credentials

SMTP

The connector will check for:

  • tags including smtp

  • label beginning with the smtp tag

  • uri using the scheme smtp

  • smtpUri, smtpuri, smtpUrl, or smtpurl fields in credentials

SQL Server

The connector will check for:

  • uri using the scheme sqlserver

  • jdbcUrl using the subprotocol sqlserver in the JDBC URL

  • sqlserverUri, sqlserveruri, sqlserverUrl, or sqlserverurl fields in credentials