java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.lambda.eventsources.KafkaDlq
All Implemented Interfaces:
IEventSourceDlq, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.119.0 (build 1634eac)", date="2025-12-01T16:02:23.788Z") @Stability(Stable) public class KafkaDlq extends software.amazon.jsii.JsiiObject implements IEventSourceDlq
A Kafka topic dead letter queue destination configuration for a Lambda event source.

This destination can only be used with Kafka-based event sources (MSK and self-managed Kafka). When used with other event source types, a validation error will be thrown.

Kafka URI Format

new KafkaDlq('my-topic');

Topic Naming Requirements

Kafka topic names must follow these rules:

  • Only alphanumeric characters, dots (.), underscores (_), and hyphens (-) are allowed
  • Cannot be empty
  • Must be a valid Kafka topic name

Example:

 import software.amazon.awscdk.services.lambda.eventsources.ManagedKafkaEventSource;
 import software.amazon.awscdk.services.lambda.eventsources.KafkaDlq;
 Function myFunction;
 // Your MSK cluster arn
 String clusterArn = "arn:aws:kafka:us-east-1:0123456789019:cluster/SalesCluster/abcd1234-abcd-cafe-abab-9876543210ab-4";
 // The Kafka topic you want to subscribe to
 String topic = "some-cool-topic";
 // Create a Kafka DLQ destination
 KafkaDlq kafkaDlq = new KafkaDlq("failure-topic");
 myFunction.addEventSource(ManagedKafkaEventSource.Builder.create()
         .clusterArn(clusterArn)
         .topic(topic)
         .startingPosition(StartingPosition.TRIM_HORIZON)
         .onFailure(kafkaDlq)
         .provisionedPollerConfig(ProvisionedPollerConfig.builder()
                 .minimumPollers(1)
                 .maximumPollers(1)
                 .build())
         .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.lambda.IEventSourceDlq

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

    Constructors
    Modifier
    Constructor
    Description
     
    KafkaDlq(String topicName)
    Creates a new Kafka DLQ destination.
    protected
    KafkaDlq(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    KafkaDlq(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    bind(IEventSourceMapping _target, IFunction _targetHandler)
    Returns a destination configuration for the DLQ.

    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

    • KafkaDlq

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

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

      @Stability(Stable) public KafkaDlq(@NotNull String topicName)
      Creates a new Kafka DLQ destination.

      Parameters:
      topicName - This parameter is required.
  • Method Details

    • bind

      @Stability(Stable) @NotNull public DlqDestinationConfig bind(@NotNull IEventSourceMapping _target, @NotNull IFunction _targetHandler)
      Returns a destination configuration for the DLQ.

      The returned configuration is used in the AWS Lambda EventSourceMapping's DestinationConfig to specify where failed records should be sent.

      Specified by:
      bind in interface IEventSourceDlq
      Parameters:
      _target - This parameter is required.
      _targetHandler - This parameter is required.
      Returns:
      The DLQ destination configuration with the properly formatted Kafka URI