This topic describes how to create an MNS topic trigger in the Function Compute console.

Create a trigger

  1. Log on to the Function Compute console.
  2. In the top navigation bar, select a region.
  3. In the left-side navigation pane, click Services and Functions.
  4. In the Services pane, click the service that you require. On the Functions tab, click the name of the function that you require.
  5. Click the Triggers tab. Then, click Create Trigger.
  6. In the Create Trigger panel, enter the relevant information. Then, click OK.
    Parameter Action
    Service Type Select MNS topic triggers.
    Trigger Name Enter the name of a custom trigger.
    Version/Alias Enter the version of the trigger. Default value: LATEST. For more information, see Introduction.
    In the MNS Topic dialog box Select MNS Topic Region.

    Please use same region for both MNS Topic and Function Compute, different regions will increase the network delay and the risk of being blocked.

    Topic Select the created Topic from the drop-down list.
    Filter Label Please input filter label.

    The function is triggered only when MNS Topic receives a message that contains the filter tag string set here.

    Retry Policy Select Retry Policy. Values:
    • Backoff Retry
    • Index Attenuation

    For more information about how to select a Retry Policy, see NotifyStrategy.

    Event Format Select the Event format. Values:
    • STREAM
    • JSON
    Role Operation
    1. Select Quick Authorization from the drop-down list.
    2. Click Authorize.
    3. Click Comfirm Authorization Policy.

    The trigger role is AliyunMNSNotificationRole.

    You can view the created trigger in the trigger list. create_MNS_trigger_result

What to do next

  1. Write a function
  2. Debug a function