• Stars
    star
    147
  • Rank 251,347 (Top 5 %)
  • Language
    Go
  • License
    MIT No Attribution
  • Created over 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An aggregated records producer for Amazon Kinesis

Amazon kinesis producer Build status License GoDoc

A KPL-like batch producer for Amazon Kinesis built on top of the official Go AWS SDK
and using the same aggregation format that KPL use.

Useful links

Example

package main

import (
	"time"

	"github.com/sirupsen/logrus"
	"github.com/a8m/kinesis-producer"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kinesis"
)

func main() {
	client := kinesis.New(session.New(aws.NewConfig()))
	pr := producer.New(&producer.Config{
		StreamName:   "test",
		BacklogCount: 2000,
		Client:       client
	})

	pr.Start()

	// Handle failures
	go func() {
		for r := range pr.NotifyFailures() {
			// r contains `Data`, `PartitionKey` and `Error()`
			log.Error(r)
		}
	}()

	go func() {
		for i := 0; i < 5000; i++ {
			err := pr.Put([]byte("foo"), "bar")
			if err != nil {
				log.WithError(err).Fatal("error producing")
			}
		}
	}()

	time.Sleep(3 * time.Second)
	pr.Stop()
}

Specifying logger implementation

producer.Config takes an optional logging.Logger implementation.

Using a custom logger
customLogger := &CustomLogger{}

&producer.Config{
  StreamName:   "test",
  BacklogCount: 2000,
  Client:       client,
  Logger:       customLogger,
}

Using logrus

import (
	"github.com/sirupsen/logrus"
	producer "github.com/a8m/kinesis-producer"
	"github.com/a8m/kinesis-producer/loggers"
)

log := logrus.New()

&producer.Config{
  StreamName:   "test",
  BacklogCount: 2000,
  Client:       client,
  Logger:       loggers.Logrus(log),
}

kinesis-producer ships with three logger implementations.

  • producer.Standard used the standard library logger
  • loggers.Logrus uses logrus logger
  • loggers.Zap uses zap logger

License

MIT

More Repositories

1

golang-cheat-sheet

An overview of Go syntax and features.
8,366
star
2

angular-filter

Bunch of useful filters for AngularJS (with no external dependencies!)
JavaScript
2,927
star
3

envsubst

Environment variables substitution for Go
Go
732
star
4

djson

Fast Go decoder for dynamic JSON
Go
601
star
5

pb

Console progress bar for Rust
Rust
580
star
6

reflect-examples

Bunch of examples for dealing with the reflect package
555
star
7

rql

Resource Query Language for REST
Go
337
star
8

syncmap

A typed implementation of the Go sync.Map using code generation
Go
256
star
9

mark

A markdown processor written in Go. built for fun.
Go
203
star
10

play

Play something while waiting for your command to finish
Go
185
star
11

enter

A CLI for generating ER diagrams for Ent schema
Go
131
star
12

ng-pipes

Bunch of useful pipes for Angular2 (with no external dependencies!)
TypeScript
118
star
13

tree

An implementation of the Unix tree command written in Go, that can be used programmatically
Go
92
star
14

agile

Like Underscore, but with zero callbacks and really more fun, v0.0.2
JavaScript
69
star
15

ent-graphql-example

The code for https://entgo.io/docs/tutorial-setup
Go
60
star
16

doqmentdb

A Promise-Based DocumentDB ODM Client for NodeJS
JavaScript
52
star
17

ng-translation

Fast, Easy and Dynamic translation for AngularJS
JavaScript
43
star
18

pb-scala

Console progress bar for Scala
Scala
37
star
19

documentdb

Go driver for Microsoft Azure DocumentDB
Go
33
star
20

expect

Minimalistic BDD-style assertions for Go (inspired by expect.js)
Go
32
star
21

deep-keys

Create an array composed of the own enumerable property names (including nested) of an object.
JavaScript
23
star
22

lease

Generic lease implementation using DynamoDB
Go
20
star
23

angular-code-mirror

2 way binding codemirror for AngularJS based on google-prettify
JavaScript
13
star
24

entclean

Clean ent/schemas
Go
11
star
25

errors

An experimental error handling package for Go
Go
10
star
26

clog

Pretty colorful cli logger for NodeJS(with table, success and more...)
JavaScript
9
star
27

s3tree

s3tree is a tree command for Amazon S3
Go
7
star
28

entspatial

An example repository for working with MySQL spatial data types in ent
Go
7
star
29

gotips-talk-2018

"Did you know that..." talk. Go-Israel meetup, Jan 2018
Go
6
star
30

maman14

maman14 - assembler
C
5
star
31

go-documentdb-example

A users CRUD app using Martini and DocumentDB
Go
4
star
32

obj-parse

Get and Set object properties in a Fast and Elegant way. (with caching and no dependencies!)
JavaScript
4
star
33

obj-del

Remove multiple keys by path - safety.
JavaScript
3
star
34

entsize

Print ent/schema size
Go
3
star
35

flag.js

cli flag parsing
JavaScript
2
star
36

dynamose

A Promise-Based DynamoDB Client
JavaScript
2
star
37

ent-sync-example

The code for https://entgo.io/blog/2021/11/1/sync-objects-in-external-database
Go
2
star
38

stringify.js

like JSON.stringify, but more sense
JavaScript
1
star
39

mark-cli

Mark command-line tool
Go
1
star
40

koa-documentdb-example

A users CRUD app using Koa and DoQmentDB(DocumentDB wrapper)
JavaScript
1
star
41

obj-is

is-function's creator
JavaScript
1
star
42

entraffle

A raffle for Ent Discord members
Go
1
star