All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
RetryPolicy.Jsii$Proxy

@Generated(value="jsii-pacmak/1.104.0 (build e79254c)", date="2024-11-22T02:24:10.409Z") @Stability(Stable) public interface RetryPolicy extends software.amazon.jsii.JsiiSerializable
The information about the retry policy settings.

Example:

 import software.amazon.awscdk.services.scheduler.*;
 import software.amazon.awscdk.services.kms.*;
 Key key;
 CfnScheduleGroup scheduleGroup;
 Queue targetQueue;
 Queue deadLetterQueue;
 Role schedulerRole = Role.Builder.create(this, "SchedulerRole")
         .assumedBy(new ServicePrincipal("scheduler.amazonaws.com"))
         .build();
 // To send the message to the queue
 // This policy changes depending on the type of target.
 schedulerRole.addToPrincipalPolicy(PolicyStatement.Builder.create()
         .actions(List.of("sqs:SendMessage"))
         .resources(List.of(targetQueue.getQueueArn()))
         .build());
 EventBridgeSchedulerCreateScheduleTask createScheduleTask1 = EventBridgeSchedulerCreateScheduleTask.Builder.create(this, "createSchedule")
         .scheduleName("TestSchedule")
         .actionAfterCompletion(ActionAfterCompletion.NONE)
         .clientToken("testToken")
         .description("TestDescription")
         .startDate(new Date())
         .endDate(new Date(new Date().getTime() + 1000 * 60 * 60))
         .flexibleTimeWindow(Duration.minutes(5))
         .groupName(scheduleGroup.getRef())
         .kmsKey(key)
         .schedule(Schedule.rate(Duration.minutes(5)))
         .timezone("UTC")
         .enabled(true)
         .target(EventBridgeSchedulerTarget.Builder.create()
                 .arn(targetQueue.getQueueArn())
                 .role(schedulerRole)
                 .retryPolicy(RetryPolicy.builder()
                         .maximumRetryAttempts(2)
                         .maximumEventAge(Duration.minutes(5))
                         .build())
                 .deadLetterQueue(deadLetterQueue)
                 .build())
         .build();
 
  • Method Details

    • getMaximumEventAge

      @Stability(Stable) @NotNull Duration getMaximumEventAge()
      The maximum amount of time to continue to make retry attempts.
    • getMaximumRetryAttempts

      @Stability(Stable) @NotNull Number getMaximumRetryAttempts()
      The maximum number of retry attempts to make before the request fails.
    • builder

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