Updated on 2023-12-04 GMT+08:00

Subscribing to an Event

Scenario

Configure SMN to obtain desktop status information in a timely manner, such as desktop creation, creation failure, startup, startup failure, shutdown, shutdown failure, and deletion failure, and report the information to Cloud Trace Service (CTS) to improve the desktop access speed and operation accuracy.

With event notifications, message queues may be blocked or CTS may fail to be called. Therefore, users cannot completely depend on event notifications. Instead, they need to periodically call APIs to update data. For any questions, submit a service ticket for technical support.

Procedure

Configuring a subscription event

  1. Enable CTS.

    When CTS is enabled, a system tracker is automatically created. You can use this tracker.

  2. Create an SMN topic.
  3. Add a subscription.
  4. Configure key event notifications.

    Configure parameters for key event notifications as follows.

    • Notification Name: This parameter is user-defined, for example, keyOperate_Workspace.
    • Operation: Select Custom. In the operation list, set Select Service to Workspace, Select Resource to workspace, and Select Operation to createDesktops, stopDesktops, startDesktops, or deleteDesktops.
    • User: Not specified.
    • Send Notification: Yes
    • Topic: Select the topic created in 2.

Verifying the subscription event

  • When a cloud desktop is started, shut down, or fails to be created, started, shut down, or deleted, the system automatically reports an event to CTS. You will receive a message based on the protocol configured in 3. For example, if you select email, you will receive a notification email.
  • You can also view all traces on the CTS console.
  1. Log in to the Workspace console.
  1. Click Service List and choose Management & Governance > Cloud Trace Service.
  2. On the Trace List page, set Trace Source to Workspace and Resource Type to workspace, and enter a resource name as required to find the corresponding trace name. For details, see the following note.

    Traces are classified into the following types:

    • createDesktops: creates a desktop
    • stopDesktops: shuts down a desktop
    • startDesktops: starts a desktop
    • deleteDesktops: deletes a desktop

  3. Click Query.
  4. Take desktop purchase as an example. View the desktop purchase trace and start the purchase, as shown in Figure 1.

    Figure 1 Starting the purchase

    View the desktop purchase trace to complete the purchase, as shown in Figure 2.

    Figure 2 Completing the purchase
    • When desktop purchase or deletion fails, a failure trace is reported. In the trace details, the value of Message is FAILED.
    • If the VM is shut down, the BEGIN message is not reported in CTS. Only the message indicating that the VM has been shut down will be reported.
    • Three minutes after the desktop is started, if the login status of the desktop is not Ready on the desktop management page, a timeout trace is reported. In the trace details, the value of Message is TIMEOUT.
    • Three minutes after the desktop is shut down, if the login status of the desktop is not Stopped on the desktop management page, a timeout trace is reported. In the trace details, the value of Message is TIMEOUT.