对本地 dynamodb 的流支持?

Stream support for local dynamodb?

我似乎无法在 dynamo db local 中获得流支持,它们受支持吗?我能找到的唯一迹象是 the developer guide regarding local differences:

中的最后一个要点

If you're using DynamoDB Streams, the rate at which shards are created might differ. In the DynamoDB web service, shard-creation behavior is partially influenced by table partition activity. When you run DynamoDB locally, there is no table partitioning. In either case, shards are ephemeral, so your application should not be dependent on shard behavior.

使用 dynamodb local 时,似乎忽略了 StreamSpecification,因此在调用 createTable 或 describeTable 时没有 LatestStreamArn

以下代码returns LatestStreamArn 具有托管的 dynamodb 服务但不是 dynamodb 本地:

ddb.createTable({
  TableName: 'streaming_test',

  AttributeDefinitions: [
    { AttributeName: 'id', AttributeType: 'S' }
  ],

  KeySchema: [
    { AttributeName: 'id', KeyType: 'HASH' }
  ],

  ProvisionedThroughput: {
    ReadCapacityUnits: 5,
    WriteCapacityUnits: 5
  },

  StreamSpecification: {
    StreamEnabled: true,
    StreamViewType: 'NEW_AND_OLD_IMAGES'
  }
}, function (err, data) {
  if (err) {
    console.log(err, err.stack)
  } else {
    // data.TableDescription.StreamSpecification and 
    // data.TableDescription.LatestStreamArn are undefined 
    // for dynamodb local
    console.log(data)
  }
})

我无法重现您的问题。我采取的步骤:

  1. here
  2. 下载本地 DynamoDB
  3. 使用 java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -sharedDb
  4. 启动本地 DynamoDB
  5. 导航到 http://localhost:8000/shell/
  6. 粘贴下面的代码并单击播放按钮。我写的和你上面的代码之间的唯一区别是我用 dynamodb.
  7. 替换了 ddb

当我这样做时,我得到了 arn:aws:dynamodb:ddblocal:000000000000:table/streaming_test/stream/2017-02-12T08:39:03.722 的 non-null 和 non-empty LatestStreamArn。

dynamodb.createTable({
  TableName: 'streaming_test',

  AttributeDefinitions: [
    { AttributeName: 'id', AttributeType: 'S' }
  ],

  KeySchema: [
    { AttributeName: 'id', KeyType: 'HASH' }
  ],

  ProvisionedThroughput: {
    ReadCapacityUnits: 5,
    WriteCapacityUnits: 5
  },

  StreamSpecification: {
    StreamEnabled: true,
    StreamViewType: 'NEW_AND_OLD_IMAGES'
  }
}, function (err, data) {
  if (err) {
    console.log(err, err.stack)
  } else {
    // data.TableDescription.StreamSpecification and 
    // data.TableDescription.LatestStreamArn are undefined 
    // for dynamodb local
    console.log(data)
  }
})