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

FGS.DmsEventMap

Element Description

The FGS.DmsEventMap element is used to create Distributed Message Service (DMS) trigger resources for FunctionGraph. DMS triggers depend on the DMS service. Based on DMS events, DMS triggers can trigger function execution. To create DMS triggers, you need to enable the DMS service and configure the IAM agencies for accessing the DMS service.

Element Properties

Table 1 Property Description

Property

Required

Descripiton

pollingInterval

No

Interval at which data is pulled from the stream.

Type: integer

Value Description: The field is an optional field in seconds. When the field is not configured, the default period of pulling data from the stream is 30 seconds.

Default: 30

Value Constraint: The effective range is 1 to 60.

Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page.

queueId

Yes

Dms queue id.

Type: string

Value Description: The field must be selected. The field is obtained from the created DMS queue.

Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page.

consumerGroupId

Yes

Dms consumer group id.

Type: string

Value Description: The field must be selected. The field is obtained from the created DMS consumer group.

Suggestion: Use the get_input function to import this field. The value can be automatically obtained on the AOS page.

funcId

Yes

function urn.

Type: string

Value Description: The field is automatically retrieved from the refID field of type HuaweiCloud.FGS.Function element by the get_reference function. The field must be selected.

Suggestion: Using the default configuration.

Relationships Between Elements

Table 2 Relationship description

Description

Target

ContainedIn

FGS.Function

Return Value

None.

Blueprint Example

tosca_definitions_version: huaweicloud_tosca_version_1_0
inputs:
  codeUrl:
    description: >-
      The address of the function code package on OBS. You need to upload the
      function code to OBS barrel in advance.
    label: Function
    type: string
  handler:
    default: index.handler
    description: >-
      The Execution Entry of the function. Default value is index. handler. It
      can be configured independently by code file name and entry function name.
    label: Function
    type: string
  memorySize:
    constraints:
      valid_values:
        - 128
        - 256
        - 512
        - 768
        - 1024
        - 1280
        - 1536
    default: 128
    description: The memory size of the function.
    label: Function
    type: integer
  name:
    constraints:
      regex: '^[a-zA-Z]([a-zA-Z0-9_-]*[a-zA-Z0-9])?$'
    default: image_watermark
    description: The name of the function.
    label: Function
    type: string
  runtime:
    constraints:
      valid_values:
        - Node.js6.10
        - Python2.7
        - Python3.6
        - Java8
        - Go1.8
        - Node.js8.10
    description: The runtime of the function.
    label: Function
    type: string
  timeout:
    constraints:
      in_range:
        - 3
        - 300
    default: 3
    description: The timeout of the function. The effective range is 3~300.
    label: Function
    type: integer
  xrole:
    description: The agency of the function. It should be created in advance.
    label: Function
    type: string
  dms_queue_id:
    description: Dms queue id.
    label: DMS trigger
    type: string
  dms_consumerGroup_id:
    description: Dms consumer group id.
    label: DMS trigger
    type: string
  dms_polling_interval:
    description: Interval at which messages are pulled from a DMS queue.
    default: 30
    type: integer
    constraints:
      in_range:
        - 1
        - 60
node_templates:
  fgsf36en:
    properties:
      codeUrl:
        get_input: codeUrl
      handler:
        get_input: handler
      memorySize:
        get_input: memorySize
      name:
        get_input: name
      role:
        get_input: xrole
      runtime:
        get_input: runtime
      timeout:
        get_input: timeout
      code: ''
      codeType: obs
    type: HuaweiCloud.FGS.Function
  fgsde1t5:
    type: HuaweiCloud.FGS.DmsEventMap
    properties:
      consumerGroupId:
        get_input: dms_consumerGroup_id
      queueId:
        get_input: dms_queue_id
      funcId:
        get_reference: fgsf36en
      pollingInterval:
        get_input: dms_polling_interval
    requirements:
      - funcId:
          node: fgsf36en
outputs:
  function-urn:
    description: function URN
    value:
      get_attribute:
        - fgsf36en
        - refID
  dms_trigger_info:
    description: DMS trigger info
    value:
      get_attribute:
        - fgsde1t5
        - dmsEventMap