Coder Social home page Coder Social logo

dynamotomongokinesisstream's Introduction

Demo DynamoDB - Kinesis - Mongo mycompany

This program aims to stream data from AWS DynamoDB to MongoDB Atlas using Kinesis.

TBC: where, in DDB, does Kinesis start streaming :

  • Assumption 1: Kinesis scan the whole DDB table
  • Assumption 2: from the time where we activate de stream
  • Assumption 3: from the time where Kinesis starts

Requirements :

  1. Create a table "CustomerSupport" in dynamoDB and activate the stream Copy/past the stream arn value to streamArn object in StreamsAdapterDemo.java

Note : to improve read/write performances, you can increase the number of write/read units on Dynamodb

  1. set your aws-cli to be used under the profile [default] if profile name is different, it might not work -> files to update (on OSX): /Users/[username]/.aws/credentials /Users/[username]/.aws/config

  2. create a DB and collection on mongodbAtlas Copy/past the mongodb Atlas connexion string value to mongoDBAtlasUrl object in StreamsAdapterDemo.java same with the database name to databaseName same with the collection name to CollectionName

  3. compilation: mvn clean install

  4. add your secret_access_key and access_key_id in the ruby script and launch to start feeding Dynamodb

  5. launch the stream mvn exec:java -Dexec.mainClass="com.mycompany.app.StreamsAdapterDemo"

there is treshold sert at 60s execution, it can be change in StreamsAdapterDemo.java Thread.sleep(600000);

  1. Don't forget to remove your DynamoDB source table and stream table

Part 2: Tutorial from AWS Amazonaws

Step 1: Create a Stream

aws kinesis create-stream --stream-name StockTradeStream --shard-count 1

NOTE: For each Amazon Kinesis Data Streams application, the KCL uses a unique Amazon DynamoDB table to keep track of the application's state. Because the KCL uses the name of the Amazon Kinesis Data Streams application to create the name of the table, each application name must be unique.

Step 2: Launch the producer from the mvn root directory

mvn exec:java -Dexec.mainClass="com.amazonaws.services.kinesis.samples.stocktrades.writer.StockTradesWriter" -Dexec.args="StockTradeStream eu-west-2"

Step 3: Launch the consumer from the mvn root directory

mvn exec:java -Dexec.mainClass="com.amazonaws.services.kinesis.samples.stocktrades.processor.StockTradesProcessor" -Dexec.args="StockTradesProcessor StockTradeStream eu-west-2"

Step 4: Clean dynamodb And Kinesis

aws kinesis delete-stream --stream-name StockTradeStream aws dynamodb delete-table --table-name StockTradesProcessor

dynamotomongokinesisstream's People

Contributors

gabparanth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.