Exemple #1
0
        public static void PersonStream(DynamoDBContext ddbc)
        {
            AWSDynamoTableConfig config = new AWSDynamoTableConfig("PersonEvents", typeof(string), "EventID", 1, 5);
            // Create a DynamoDBContext
            DynamoDBContext ddbcEvents = DynamoDBContext.GetDynamoDBContext(
                RegionEndpoint.EUWest1,
                "##################",                           // Access key
                "#########################################",    // Secret key
                config                                          // Table config
                );

            var stream = ddbc.GetAWSDynamoDBStream(AWSDynamoDBIteratorType.LATEST);

            while (true)
            {
                Thread.Sleep(5000);
                Console.WriteLine("- - - - - - - - - - - - - - - - ");
                Console.WriteLine("Getting records");
                var records = stream.GetRecords <Person>();
                foreach (var record in records)
                {
                    Console.WriteLine("EventName: " + record.EventName + " || Person ID: " + record.NewImage.Id + " || SequenceNumber: " + record.SequenceNumber);
                    ddbcEvents.Insert(record);
                }
            }
        }