You can use an MQTT client to subscribe to messages about VMware Cloud Director events and tasks.

MQTT is a lightweight, binary, messaging transport protocol. VMware Cloud Director uses MQTT to publish information about events and tasks to which you can subscribe by using an MQTT client. MQTT messages pass through an MQTT broker which can also store messages in case the clients are not online.

Starting with VMware Cloud Director 10.2.2, you can use an MQTT client to subscribe to metrics.

Prerequisites

  • Verify that you have an MQTT client that supports WebSocket.
  • Verify that you can add headers to a WebSocket-upgraded request.
  • If you want to subscribe to metrics, configure the metrics collection and enable metrics publishing. See Configure Metrics Collection and Publishing.

Procedure

  1. Log in to VMware Cloud Director by using the OpenAPI endpoint.
  2. To establish a WebSocket connection, set the Sec-WebSocket-Protocol property to mqtt, set the client to connect to the /messaging/mqtt path, add an authorization header, and follow the standard MQTT connect flow.
    You receive the JWT token from the standard login request to VMware Cloud Director. You can leave the user name and password empty.
    Sec-WebSocket-Protocol: mqtt
    Authorization: Bearer {JWT_token}
  3. Once the connection is established successfully, subscribe to topics through the MQTT client.
    publish/{user_org_id}/{user_id}
    publish/debd63a0-6eae-11ea-8c7b-0050561776be/d19fd8ff-6eae-11ea-bb42-0050561776c8
    Organization administrators can use wildcards to access all organization topics.
    publish/{user_org_id}/+ 
    System administrators can use wildcards to access all topics.
    publish/#
  4. (Optional) For VMware Cloud Director 10.2.2 or later, subscribe to metrics.
    metrics/{org_id}/{vApp_id}

    Only system administrators can access the metrics topic.