Class BatchJobProps
Customize the Batch Job Event Target.
Inheritance
Namespace: Amazon.CDK.AWS.Events.Targets
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BatchJobProps : Object, IBatchJobProps, ITargetBaseProps
Syntax (vb)
Public Class BatchJobProps
Inherits Object
Implements IBatchJobProps, ITargetBaseProps
Remarks
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.EC2;
using Amazon.CDK.AWS.ECS;
using Amazon.CDK.AWS.Batch;
Vpc vpc;
var computeEnvironment = new FargateComputeEnvironment(this, "ComputeEnv", new FargateComputeEnvironmentProps {
Vpc = vpc
});
var jobQueue = new JobQueue(this, "JobQueue", new JobQueueProps {
Priority = 1,
ComputeEnvironments = new [] { new OrderedComputeEnvironment {
ComputeEnvironment = computeEnvironment,
Order = 1
} }
});
var jobDefinition = new EcsJobDefinition(this, "MyJob", new EcsJobDefinitionProps {
Container = new EcsEc2ContainerDefinition(this, "Container", new EcsEc2ContainerDefinitionProps {
Image = ContainerImage.FromRegistry("test-repo"),
Memory = Size.Mebibytes(2048),
Cpu = 256
})
});
var queue = new Queue(this, "Queue");
var rule = new Rule(this, "Rule", new RuleProps {
Schedule = Schedule.Rate(Duration.Hours(1))
});
rule.AddTarget(new BatchJob(jobQueue.JobQueueArn, jobQueue, jobDefinition.JobDefinitionArn, jobDefinition, new BatchJobProps {
DeadLetterQueue = queue,
Event = RuleTargetInput.FromObject(new Dictionary<string, string> { { "SomeParam", "SomeValue" } }),
RetryAttempts = 2,
MaxEventAge = Duration.Hours(2)
}));
Synopsis
Constructors
BatchJobProps() |
Properties
Attempts | The number of times to attempt to retry, if the job fails. |
DeadLetterQueue | The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue. |
Event | The event to send to the Lambda. |
JobName | The name of the submitted job. |
MaxEventAge | The maximum age of a request that Lambda sends to a function for processing. |
RetryAttempts | The maximum number of times to retry when the function returns an error. |
Size | The size of the array, if this is an array batch job. |
Constructors
BatchJobProps()
public BatchJobProps()
Properties
Attempts
The number of times to attempt to retry, if the job fails.
public Nullable<double> Attempts { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Valid values are 1–10.
Default: no retryStrategy is set
DeadLetterQueue
The SQS queue to be used as deadLetterQueue. Check out the considerations for using a dead-letter queue.
public IQueue DeadLetterQueue { get; set; }
Property Value
Remarks
The events not successfully delivered are automatically retried for a specified period of time, depending on the retry policy of the target. If an event is not delivered before all retry attempts are exhausted, it will be sent to the dead letter queue.
Default: - no dead-letter queue
Event
The event to send to the Lambda.
public RuleTargetInput Event { get; set; }
Property Value
Remarks
This will be the payload sent to the Lambda Function.
Default: the entire EventBridge event
JobName
The name of the submitted job.
public string JobName { get; set; }
Property Value
System.String
Remarks
Default: - Automatically generated
MaxEventAge
The maximum age of a request that Lambda sends to a function for processing.
public Duration MaxEventAge { get; set; }
Property Value
Remarks
Minimum value of 60. Maximum value of 86400.
Default: Duration.hours(24)
RetryAttempts
The maximum number of times to retry when the function returns an error.
public Nullable<double> RetryAttempts { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Minimum value of 0. Maximum value of 185.
Default: 185
Size
The size of the array, if this is an array batch job.
public Nullable<double> Size { get; set; }
Property Value
System.Nullable<System.Double>
Remarks
Valid values are integers between 2 and 10,000.
Default: no arrayProperties are set