> **Experimental**
>
> `@aws-cdk/aws-pipes-sources-alpha` is an [**experimental**](https://docs.aws.amazon.com/cdk/api/stability.html) (alpha) package: its API may change in any release, without a major version bump.
# DynamoDBSourceParameters

Parameters for the DynamoDB source.

Extends: [StreamSourceParameters](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-sources-alpha.StreamSourceParameters.html)
Used as props by: [DynamoDBSource](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-sources-alpha.DynamoDBSource.html)

- Stability: [Experimental](https://docs.aws.amazon.com/cdk/api/stability.html)
- Source: [`lib/dynamodb.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-pipes-sources-alpha/lib/dynamodb.ts#L11)

## Example

TypeScript:

```ts
const table = new ddb.TableV2(this, 'MyTable', {
  partitionKey: {
    name: 'id',
    type: ddb.AttributeType.STRING,
  },
  dynamoStream: ddb.StreamViewType.NEW_IMAGE,
});
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.DynamoDBSource(table, {
  startingPosition: sources.DynamoDBStartingPosition.LATEST,
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
```

Python:

```python
# target_queue: sqs.Queue
table = ddb.TableV2(self, "MyTable",
    partition_key=ddb.Attribute(
        name="id",
        type=ddb.AttributeType.STRING
    ),
    dynamo_stream=ddb.StreamViewType.NEW_IMAGE
)

pipe_source = sources.DynamoDBSource(table,
    starting_position=sources.DynamoDBStartingPosition.LATEST
)

pipe = pipes.Pipe(self, "Pipe",
    source=pipe_source,
    target=SqsTarget(target_queue)
)
```

Java:

```java
Queue targetQueue;
TableV2 table = TableV2.Builder.create(this, "MyTable")
        .partitionKey(Attribute.builder()
                .name("id")
                .type(AttributeType.STRING)
                .build())
        .dynamoStream(StreamViewType.NEW_IMAGE)
        .build();

DynamoDBSource pipeSource = DynamoDBSource.Builder.create(table)
        .startingPosition(DynamoDBStartingPosition.LATEST)
        .build();

Pipe pipe = Pipe.Builder.create(this, "Pipe")
        .source(pipeSource)
        .target(new SqsTarget(targetQueue))
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Pipes.Sources.Alpha
Queue targetQueue;
var table = new TableV2(this, "MyTable", new TablePropsV2 {
    PartitionKey = new Attribute {
        Name = "id",
        Type = AttributeType.STRING
    },
    DynamoStream = StreamViewType.NEW_IMAGE
});

var pipeSource = new DynamoDBSource(table, new DynamoDBSourceParameters {
    StartingPosition = DynamoDBStartingPosition.LATEST
});

var pipe = new Pipe(this, "Pipe", new PipeProps {
    Source = pipeSource,
    Target = new SqsTarget(targetQueue)
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdkpipessourcesalpha/v2
var targetQueue Queue
table := ddb.NewTableV2(this, jsii.String("MyTable"), &TablePropsV2{
	PartitionKey: &Attribute{
		Name: jsii.String("id"),
		Type: ddb.AttributeType_STRING,
	},
	DynamoStream: ddb.StreamViewType_NEW_IMAGE,
})

pipeSource := sources.NewDynamoDBSource(table, &DynamoDBSourceParameters{
	StartingPosition: sources.DynamoDBStartingPosition_LATEST,
})

pipe := pipes.NewPipe(this, jsii.String("Pipe"), &PipeProps{
	Source: pipeSource,
	Target: awscdkpipestargetsalpha.NewSqsTarget(targetQueue),
})
```

## Properties

- `batchSize`: number = 1 — The maximum number of records to include in each batch.

- `deadLetterTarget`: [IQueue](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sqs.IQueue.html) | [ITopic](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_sns.ITopic.html) — Define the target to send dead-letter queue events to.

  **Default:** no dead-letter queue or topic

  The dead-letter queue stores any events that are not successfully delivered to a Pipes target after all retry attempts are exhausted.
  You can then resolve the issue that caused the failed invocations and replay the events at a later time.
  In some cases, such as when access is denied to a resource, events are sent directly to the dead-letter queue and are not retried.

- `maximumBatchingWindow`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — The maximum length of a time to wait for events.

  **Default:** the events will be handled immediately

- `maximumRecordAge`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Discard records older than the specified age.

  **Default:** -1 - EventBridge won't discard old records

  The default value is -1, which sets the maximum age to infinite. When the value is set to infinite, EventBridge never discards old records.

- `maximumRetryAttempts`: number — Discard records after the specified number of retries.

  **Default:** -1 - EventBridge will retry failed records until the record expires in the event source

  The default value is -1, which sets the maximum number of retries to infinite. When MaximumRetryAttempts is infinite, EventBridge retries failed records until the record expires in the event source.

- `onPartialBatchItemFailure`: [OnPartialBatchItemFailure](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-sources-alpha.OnPartialBatchItemFailure.html) — Define how to handle item process failures.

  **Default:** off - EventBridge will retry the entire batch

  {@link OnPartialBatchItemFailure.AUTOMATIC_BISECT} halves each batch and will retry each half until all the records are processed or there is one failed message left in the batch.

- `parallelizationFactor`: number = 1 — The number of batches to process concurrently from each shard.

- `startingPosition`: [DynamoDBStartingPosition](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-pipes-sources-alpha.DynamoDBStartingPosition.html) (required) — The position in a stream from which to start reading.
