![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@aws-sdk/client-dynamodb-streams
Advanced tools
AWS SDK for JavaScript Dynamodb Streams Client for Node.js, Browser and React Native
@aws-sdk/client-dynamodb-streams is a part of the AWS SDK for JavaScript, which allows you to interact with Amazon DynamoDB Streams. DynamoDB Streams capture a time-ordered sequence of item-level modifications in a DynamoDB table and store this information for up to 24 hours. This package enables you to work with these streams, allowing you to capture and process changes to your DynamoDB tables.
List Streams
This feature allows you to list all the streams associated with a DynamoDB table. The code sample demonstrates how to create a DynamoDBStreamsClient, create a ListStreamsCommand, and send the command to list the streams.
{"language":"javascript","content":"const { DynamoDBStreamsClient, ListStreamsCommand } = require('@aws-sdk/client-dynamodb-streams');\n\nconst client = new DynamoDBStreamsClient({ region: 'us-west-2' });\n\nconst listStreams = async () => {\n const command = new ListStreamsCommand({ TableName: 'YourTableName' });\n const response = await client.send(command);\n console.log(response.Streams);\n};\n\nlistStreams();"}
Describe Stream
This feature allows you to describe a specific stream. The code sample demonstrates how to create a DescribeStreamCommand with a given StreamArn and send the command to get the stream description.
{"language":"javascript","content":"const { DynamoDBStreamsClient, DescribeStreamCommand } = require('@aws-sdk/client-dynamodb-streams');\n\nconst client = new DynamoDBStreamsClient({ region: 'us-west-2' });\n\nconst describeStream = async (streamArn) => {\n const command = new DescribeStreamCommand({ StreamArn: streamArn });\n const response = await client.send(command);\n console.log(response.StreamDescription);\n};\n\ndescribeStream('your-stream-arn');"}
Get Shard Iterator
This feature allows you to get a shard iterator, which is used to read stream records from a shard. The code sample demonstrates how to create a GetShardIteratorCommand with the necessary parameters and send the command to get the shard iterator.
{"language":"javascript","content":"const { DynamoDBStreamsClient, GetShardIteratorCommand } = require('@aws-sdk/client-dynamodb-streams');\n\nconst client = new DynamoDBStreamsClient({ region: 'us-west-2' });\n\nconst getShardIterator = async (streamArn, shardId) => {\n const command = new GetShardIteratorCommand({\n StreamArn: streamArn,\n ShardId: shardId,\n ShardIteratorType: 'TRIM_HORIZON'\n });\n const response = await client.send(command);\n console.log(response.ShardIterator);\n};\n\ngetShardIterator('your-stream-arn', 'your-shard-id');"}
Get Records
This feature allows you to get records from a shard using a shard iterator. The code sample demonstrates how to create a GetRecordsCommand with a given ShardIterator and send the command to retrieve the records.
{"language":"javascript","content":"const { DynamoDBStreamsClient, GetRecordsCommand } = require('@aws-sdk/client-dynamodb-streams');\n\nconst client = new DynamoDBStreamsClient({ region: 'us-west-2' });\n\nconst getRecords = async (shardIterator) => {\n const command = new GetRecordsCommand({ ShardIterator: shardIterator });\n const response = await client.send(command);\n console.log(response.Records);\n};\n\ngetRecords('your-shard-iterator');"}
The 'kinesis' package allows you to interact with Amazon Kinesis Streams, which is similar to DynamoDB Streams but designed for real-time processing of streaming data at scale. While DynamoDB Streams is specific to DynamoDB table changes, Kinesis Streams can handle a broader range of streaming data use cases.
The 'aws-sdk' package is the older version of the AWS SDK for JavaScript, which includes support for DynamoDB Streams among many other AWS services. The newer modular packages like '@aws-sdk/client-dynamodb-streams' offer more fine-grained control and smaller bundle sizes.
AWS SDK for JavaScript DynamoDBStreams Client for Node.js, Browser and React Native.
Amazon DynamoDB
Amazon DynamoDB Streams provides API actions for accessing streams and processing stream records. To learn more about application development with Streams, see Capturing Table Activity with DynamoDB Streams in the Amazon DynamoDB Developer Guide.
To install this package, simply type add or install @aws-sdk/client-dynamodb-streams using your favorite package manager:
npm install @aws-sdk/client-dynamodb-streams
yarn add @aws-sdk/client-dynamodb-streams
pnpm add @aws-sdk/client-dynamodb-streams
The AWS SDK is modulized by clients and commands.
To send a request, you only need to import the DynamoDBStreamsClient
and
the commands you need, for example ListStreamsCommand
:
// ES5 example
const { DynamoDBStreamsClient, ListStreamsCommand } = require("@aws-sdk/client-dynamodb-streams");
// ES6+ example
import { DynamoDBStreamsClient, ListStreamsCommand } from "@aws-sdk/client-dynamodb-streams";
To send a request, you:
send
operation on client with command object as input.destroy()
to close open connections.// a client can be shared by different commands.
const client = new DynamoDBStreamsClient({ region: "REGION" });
const params = {
/** input parameters */
};
const command = new ListStreamsCommand(params);
We recommend using await operator to wait for the promise returned by send operation as follows:
// async/await.
try {
const data = await client.send(command);
// process data.
} catch (error) {
// error handling.
} finally {
// finally.
}
Async-await is clean, concise, intuitive, easy to debug and has better error handling as compared to using Promise chains or callbacks.
You can also use Promise chaining to execute send operation.
client.send(command).then(
(data) => {
// process data.
},
(error) => {
// error handling.
}
);
Promises can also be called using .catch()
and .finally()
as follows:
client
.send(command)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
})
.finally(() => {
// finally.
});
We do not recommend using callbacks because of callback hell, but they are supported by the send operation.
// callbacks.
client.send(command, (err, data) => {
// process err and data.
});
The client can also send requests using v2 compatible style. However, it results in a bigger bundle size and may be dropped in next major version. More details in the blog post on modular packages in AWS SDK for JavaScript
import * as AWS from "@aws-sdk/client-dynamodb-streams";
const client = new AWS.DynamoDBStreams({ region: "REGION" });
// async/await.
try {
const data = await client.listStreams(params);
// process data.
} catch (error) {
// error handling.
}
// Promises.
client
.listStreams(params)
.then((data) => {
// process data.
})
.catch((error) => {
// error handling.
});
// callbacks.
client.listStreams(params, (err, data) => {
// process err and data.
});
When the service returns an exception, the error will include the exception information, as well as response metadata (e.g. request id).
try {
const data = await client.send(command);
// process data.
} catch (error) {
const { requestId, cfId, extendedRequestId } = error.$metadata;
console.log({ requestId, cfId, extendedRequestId });
/**
* The keys within exceptions are also parsed.
* You can access them by specifying exception names:
* if (error.name === 'SomeServiceException') {
* const value = error.specialKeyInException;
* }
*/
}
Please use these community resources for getting help. We use the GitHub issues for tracking bugs and feature requests, but have limited bandwidth to address them.
aws-sdk-js
on AWS Developer Blog.aws-sdk-js
.To test your universal JavaScript code in Node.js, browser and react-native environments, visit our code samples repo.
This client code is generated automatically. Any modifications will be overwritten the next time the @aws-sdk/client-dynamodb-streams
package is updated.
To contribute to client you can check our generate clients scripts.
This SDK is distributed under the Apache License, Version 2.0, see LICENSE for more information.
FAQs
AWS SDK for JavaScript Dynamodb Streams Client for Node.js, Browser and React Native
The npm package @aws-sdk/client-dynamodb-streams receives a total of 0 weekly downloads. As such, @aws-sdk/client-dynamodb-streams popularity was classified as not popular.
We found that @aws-sdk/client-dynamodb-streams demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.