Git Product home page Git Product logo

docker-kinesis's Introduction

docker-kinesis

Combines Kinesis mhart/kinesalite and DynamoDB mhart/dynalite

Image also contains aws-cli to allow simpler communication with kinesis

Build docker image

docker build -t kinesis \
 --build-arg AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
 --build-arg AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}\
 --build-arg AWS_DEFAULT_REGION=${AWS_DEFAULT_REGION}

Run docker

    docker run --name kinesis -d kinesis

Kinesis service exposed on port 443. when running docker, you would probably have to map 443 to a different local port (i.e 4567)

DynamoDB service exposed on port 4568

initializing kinesis

Once docker starts running kinesalite, an initialization script is executed, the script init_kinesis.sh allows you to create streams in advance before the service starts running.

#!/usr/bin/env bash

#
## list all streams to create
#
#declare -a streamNames=(
#  "stream1"
#  "stream2"
#  ...
#  "streamN"
#)
#
#for streamName in "${streamNames[@]}"
#do
#    ./create_stream.sh ${streamName}
#done
#

remotely create stream

docker exec -i kinesis ./create_stream.sh streamname_to_create

connecting via AWS-cli

aws --endpoint-url='https://localhost*' --no-verify-ssl kinesis

configuring Aws objects

KCL

val kinesisClient: AmazonKinesis = AmazonKinesisClientBuilder.standard()
  .withCredentials(credentialsProvider)
  .withEndpointConfiguration(new EndpointConfiguration("localhost:4567", region))
  .build()

val dynamoDBClient: AmazonDynamoDB = AmazonDynamoDBClientBuilder.standard()
  .withCredentials(credentialsProvider)
  .withEndpointConfiguration(new EndpointConfiguration("localhost:4568", region))
  .build()
          
new Worker.Builder()
      .recordProcessorFactory(recordProcessorFactory)
      .config(libConfig)
      .kinesisClient(kinesisClient)
      .dynamoDBClient(dynamoDBClient)
      .build()

KPL

new KinesisProducerConfiguration()
      .setRegion(config.region)
      .setCredentialsProvider(CredentialsProvider())
      .setMaxConnections(24)
      .setRequestTimeout(30000)
      .setAggregationEnabled(true)
      .setRecordMaxBufferedTime(config.recordMaxBufferedTime.toMillis)
      .setKinesisEndpoint("localhost")
      .setKinesisPort("4567")
      .setVerifyCertificate(false)

docker-kinesis's People

Contributors

oriy avatar

Watchers

 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.