Route events to Function Compute

更新时间:
复制 MD 格式

This topic describes how to add Function Compute as a sink for an event stream in the EventBridge console.

Prerequisites

Create an event stream

  1. Log in to the EventBridge console. In the navigation pane on the left, click Event Streams.
  2. In the top navigation bar, select a region, and then click Create Event Stream.
  3. In the Create Event Stream panel, set the Task Name and Description, configure the following parameters, and then click Save.

    • Create the task

      1. In the Source, Filtering, and Transformation steps, configure the data provider, event filter, and transformation rules, and then click Next. For more information about event transformation, see Use Function Compute to cleanse message data.

      2. In the Sink step, select Function Compute from the Service Type drop-down list, and then configure the following parameters.

        Parameter

        Description

        Example

        Service Type

        Select the Function Compute service you created.

        test

        Function

        Select the Function Compute function you created.

        test

        Version/Alias

        Select Specified Version to use a specific version of the target function, or Specified Alias to use an alias of the target function.

        • Specified Version

        • LATEST

        Invocation Mode

        Select an invocation mode:

        • Asynchronous: Indicates that the function is invoked asynchronously when data is delivered to FC.

        • Synchronous: The function is invoked synchronously when data is delivered to FC.

        Asynchronous

        Event Format

        Select an event format:

        • Object: Delivers the event to the downstream function as a single object.

        • ObjectList: Delivers events to the downstream function as an array of objects.

        Note

        If you do not select an event format, EventBridge uses the ObjectList by default.

        Object

        Event

        Select an event content transformation type. For more information, see Event content transformation.

        Complete Event

    • Task properties

      Configure the retry policy and dead-letter queue for the event stream. For more information, see Retry policies and dead-letter queues.

  4. Return to the Event Streams page. Find your event stream, and in the Actions column, click Enable.

    After you enable the event stream, it may take 30 to 60 seconds to start. You can view the startup progress in the Status column on the Event Streams page.

Verify the results

  1. On the Event Streams page, click the function name in the Event Targets column to open the function's details page.

  2. On the function details page, click the Invocation Logs tab and then click Function Logs to view the invocation logs.

    The logs show that an event has successfully invoked the function. The log content includes records such as FC Invoke Start RequestId, trigger information (including fields such as triggerTime, triggerName, and payload), and FC Invoke End RequestId.