Interface BatchJobProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable, TargetBaseProps
All Known Implementing Classes:
BatchJobProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-06T23:25:10.340Z") @Stability(Stable) public interface BatchJobProps extends software.amazon.jsii.JsiiSerializable, TargetBaseProps
Customize the Batch Job Event Target.

Example:

 import software.amazon.awscdk.services.ec2.*;
 import software.amazon.awscdk.services.ecs.*;
 import software.amazon.awscdk.services.batch.*;
 import software.amazon.awscdk.services.ecs.ContainerImage;
 Vpc vpc;
 FargateComputeEnvironment computeEnvironment = FargateComputeEnvironment.Builder.create(this, "ComputeEnv")
         .vpc(vpc)
         .build();
 JobQueue jobQueue = JobQueue.Builder.create(this, "JobQueue")
         .priority(1)
         .computeEnvironments(List.of(OrderedComputeEnvironment.builder()
                 .computeEnvironment(computeEnvironment)
                 .order(1)
                 .build()))
         .build();
 EcsJobDefinition jobDefinition = EcsJobDefinition.Builder.create(this, "MyJob")
         .container(EcsEc2ContainerDefinition.Builder.create(this, "Container")
                 .image(ContainerImage.fromRegistry("test-repo"))
                 .memory(Size.mebibytes(2048))
                 .cpu(256)
                 .build())
         .build();
 Queue queue = new Queue(this, "Queue");
 Rule rule = Rule.Builder.create(this, "Rule")
         .schedule(Schedule.rate(Duration.hours(1)))
         .build();
 rule.addTarget(BatchJob.Builder.create(jobQueue.getJobQueueArn(), jobQueue, jobDefinition.getJobDefinitionArn(), jobDefinition)
         .deadLetterQueue(queue)
         .event(RuleTargetInput.fromObject(Map.of("SomeParam", "SomeValue")))
         .retryAttempts(2)
         .maxEventAge(Duration.hours(2))
         .build());
 
  • Method Details

    • getAttempts

      @Stability(Stable) @Nullable default Number getAttempts()
      The number of times to attempt to retry, if the job fails.

      Valid values are 1–10.

      Default: no retryStrategy is set

    • getEvent

      @Stability(Stable) @Nullable default RuleTargetInput getEvent()
      The event to send to the Lambda.

      This will be the payload sent to the Lambda Function.

      Default: the entire EventBridge event

    • getJobName

      @Stability(Stable) @Nullable default String getJobName()
      The name of the submitted job.

      Default: - Automatically generated

    • getSize

      @Stability(Stable) @Nullable default Number getSize()
      The size of the array, if this is an array batch job.

      Valid values are integers between 2 and 10,000.

      Default: no arrayProperties are set

    • builder

      @Stability(Stable) static BatchJobProps.Builder builder()
      Returns:
      a BatchJobProps.Builder of BatchJobProps