java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.events.targets.BatchJob
All Implemented Interfaces:
IRuleTarget, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:47.711Z") @Stability(Stable) public class BatchJob extends software.amazon.jsii.JsiiObject implements IRuleTarget
Use an AWS Batch Job / Queue as an event rule target.

Most likely the code will look something like this: new BatchJob(jobQueue.jobQueueArn, jobQueue, jobDefinition.jobDefinitionArn, jobDefinition)

In the future this API will be improved to be fully typed

Example:

 import software.amazon.awscdk.services.batch.*;
 import software.amazon.awscdk.services.ecs.ContainerImage;
 JobQueue jobQueue = JobQueue.Builder.create(this, "MyQueue")
         .computeEnvironments(List.of(JobQueueComputeEnvironment.builder()
                 .computeEnvironment(ComputeEnvironment.Builder.create(this, "ComputeEnvironment")
                         .managed(false)
                         .build())
                 .order(1)
                 .build()))
         .build();
 JobDefinition jobDefinition = JobDefinition.Builder.create(this, "MyJob")
         .container(JobDefinitionContainer.builder()
                 .image(ContainerImage.fromRegistry("test-repo"))
                 .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());
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    A fluent builder for BatchJob.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode

    Nested classes/interfaces inherited from interface software.amazon.awscdk.services.events.IRuleTarget

    IRuleTarget.Jsii$Default, IRuleTarget.Jsii$Proxy
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    BatchJob(String jobQueueArn, IConstruct jobQueueScope, String jobDefinitionArn, IConstruct jobDefinitionScope)
     
     
    BatchJob(String jobQueueArn, IConstruct jobQueueScope, String jobDefinitionArn, IConstruct jobDefinitionScope, BatchJobProps props)
     
    protected
    BatchJob(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    BatchJob(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    bind(IRule rule)
    Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.
    bind(IRule rule, String _id)
    Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • BatchJob

      protected BatchJob(software.amazon.jsii.JsiiObjectRef objRef)
    • BatchJob

      protected BatchJob(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • BatchJob

      @Stability(Stable) public BatchJob(@NotNull String jobQueueArn, @NotNull IConstruct jobQueueScope, @NotNull String jobDefinitionArn, @NotNull IConstruct jobDefinitionScope, @Nullable BatchJobProps props)
      Parameters:
      jobQueueArn - The JobQueue arn. This parameter is required.
      jobQueueScope - The JobQueue Resource. This parameter is required.
      jobDefinitionArn - The jobDefinition arn. This parameter is required.
      jobDefinitionScope - The JobQueue Resource. This parameter is required.
      props -
    • BatchJob

      @Stability(Stable) public BatchJob(@NotNull String jobQueueArn, @NotNull IConstruct jobQueueScope, @NotNull String jobDefinitionArn, @NotNull IConstruct jobDefinitionScope)
      Parameters:
      jobQueueArn - The JobQueue arn. This parameter is required.
      jobQueueScope - The JobQueue Resource. This parameter is required.
      jobDefinitionArn - The jobDefinition arn. This parameter is required.
      jobDefinitionScope - The JobQueue Resource. This parameter is required.
  • Method Details

    • bind

      @Stability(Stable) @NotNull public RuleTargetConfig bind(@NotNull IRule rule, @Nullable String _id)
      Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.

      Specified by:
      bind in interface IRuleTarget
      Parameters:
      rule - This parameter is required.
      _id -
    • bind

      @Stability(Stable) @NotNull public RuleTargetConfig bind(@NotNull IRule rule)
      Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.

      Specified by:
      bind in interface IRuleTarget
      Parameters:
      rule - This parameter is required.