Class BatchJob
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.104.0 (build e79254c)",
date="2024-12-17T21:37:31.508Z")
@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.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());
-
Nested Class Summary
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
ModifierConstructorDescriptionBatchJob
(String jobQueueArn, software.constructs.IConstruct jobQueueScope, String jobDefinitionArn, software.constructs.IConstruct jobDefinitionScope) BatchJob
(String jobQueueArn, software.constructs.IConstruct jobQueueScope, String jobDefinitionArn, software.constructs.IConstruct jobDefinitionScope, BatchJobProps props) protected
BatchJob
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
BatchJob
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionReturns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.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 software.constructs.IConstruct jobQueueScope, @NotNull String jobDefinitionArn, @NotNull software.constructs.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 software.constructs.IConstruct jobQueueScope, @NotNull String jobDefinitionArn, @NotNull software.constructs.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
Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.- Specified by:
bind
in interfaceIRuleTarget
- Parameters:
rule
- This parameter is required._id
-
-
bind
Returns a RuleTarget that can be used to trigger queue this batch job as a result from an EventBridge event.- Specified by:
bind
in interfaceIRuleTarget
- Parameters:
rule
- This parameter is required.
-