adding EventBatchingCondition to CDK trigger

0

Hi team, I want to create a glue trigger via the CDK and associate it with a workflow,

the trigger is of type "EVENT"

I want to add the following config to my trigger via CDK :

"EventBatchingCondition": {
            "BatchSize": 5,
            "BatchWindow": 900
        }

but did not find any object allowing me to add this config to the CfnTrigger.

this is my CDK code :

const glueEdwWorkflowTrigger = new glue.CfnTrigger(
      this,
      "trigger",
      {
        name: "trigger",
        workflowName: myWorkFlow.name,
        type: "EVENT",

        predicate:{conditions:[{}]},
        actions: [
          {
            jobName: myCfnJob.name,
            arguments: {},
          },
        ]
      }
    );

how can I add EventBatchingCondition info to my CfnTrigger?

thanks a lot.

1개 답변
0

Hi there,

As of now the support of EventBatchingCondition property on a trigger is not yet available in CloudFormation, thus CfnTrigger construct does not have such capability neither. You can track this open Github issue for latest update on this feature request. As of now, one workaround can be to use the CDK custom resource AwsCustomResource construct to invoke UpdateTrigger API to add EventBatchingCondition, once the trigger was created.

지원 엔지니어
답변함 2년 전
  • Thank you for your answer! could you please share with me an example of how can I use AwsCustomResource to UpdateTrigger and add EventBatchingCondition ?

  • Hey there, I don't have any specific example for UpdateTrigger, the you can find some examples here that show the same idea to make API calls in custom resource.

  • Unfortunately, since UpdateTrigger requires you to provide an entirely hydrated TriggerUpdate object (see https://docs.aws.amazon.com/glue/latest/webapi/API_TriggerUpdate.html) which "updates the previous trigger definition by overwriting it completely", you would need some way to invoke GetTrigger first, and get its entire response that you could then modify to include your EventBatchingCondition definition. Unfortunately, if you try to do this with an AwsCustomResource in CDK, there's no good way to get the entire response, as getResponseField only returns a single field from the response, not an entire object.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠