2016-01-19 24 views
7

我似乎無法獲得在本地Dynamo數據庫中工作的流支持,他們是否支持?我能找到,他們是唯一的指示,在http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html#Tools.DynamoDBLocal.Differences當地dynamodb的流支持?

隨着dynamodb當地的最後的子彈點,看來該StreamSpecification被忽略,所以沒有LatestStreamArn調用CREATETABLE或describeTable

下面的代碼時,返回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) 
    } 
}) 

回答

5

我無法重現您的問題。步驟我把:

  1. 下載DynamoDB本地從here
  2. 開始DynamoDB本地與java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -inMemory -sharedDb
  3. 導航到http://localhost:8000/shell/
  4. 下面的代碼粘貼,點擊播放按鈕。我寫的和上面的代碼之間的唯一區別是我用dynamodb替換了ddb

當我這樣做,我得到了一個非空和非空的LatestStreamArn arn:aws:dynamodb:ddblocal:000000000000:table/streaming_test/stream/2017-02-12T08:39:03.722

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) 
    } 
})