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 Service/Function.
  4. Locate the target function in the target service and click the function name.
  5. Click the Triggers tab, and then click Create Trigger.
    create_trigger
  6. In the Create Trigger area, enter information as prompted. 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 Authorizationfrom 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