Updated on 2023-08-18 GMT+08:00

Configuring a Message Notification

  1. Log in to the SMN console, choose Topic Management > Topics, and click Create Topic.
  2. Set the topic information, and click OK.
    • Topic Name: Enter AStoFunctionGraph.
    • Enterprise Project: Select default or another one.
      Figure 1 Creating a topic
  3. Log in to the AS console, go to the details page of the target AS group, click the Lifecycle Hooks tab, and then click Add Lifecycle Hook.
    Figure 2 Lifecycle hooks
  4. Configure the lifecycle hook information, and click OK. This hook is used to suspend the scaled-in instances and send a message to the specified SMN topic.
    • Hook Type: Select Instance removal.
    • Default Callback Action: Select Continue.
    • Timeout Duration: Enter 300.
    • Notification Topic: Select AStoFunctionGraph.
      Figure 3 Creating a lifecycle hook
  5. Go to the FunctionGraph console. On the details page of function as_graceful_shutdown, choose Configuration > Triggers, and click Create Trigger.
  6. Select SMN for the trigger type and AStoFunctionGraph for the topic. Then the messages received by this topic will trigger the handler function.
    Figure 4 Creating a trigger