Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version3 package refactor #54

Open
wants to merge 110 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
f6f2f66
new listener
twang-rs Mar 27, 2017
dc17c6f
refactored listener, added kinetic
twang-rs Mar 29, 2017
f94ded4
go vet & golint fixes
twang-rs Mar 29, 2017
41e8fb3
gosimple fixes
twang-rs Mar 29, 2017
9481b6a
more go vet & go race fixes
twang-rs Mar 29, 2017
a1d14e4
Simplify configuration implementation
twang-rs Mar 31, 2017
60f11c0
Disable ListenFn test
twang-rs Mar 31, 2017
c78e129
Fix race condition in ListenFn test
twang-rs Mar 31, 2017
2fcc21d
producer -- work in progress
twang-rs Apr 5, 2017
0d27501
lint & build fixes
twang-rs Apr 6, 2017
29483f6
producer refactor, wip
twang-rs Apr 7, 2017
69c785e
producer (kinesis + firehose)
twang-rs May 5, 2017
5805f55
wip
twang-rs May 9, 2017
d4de4d0
Stabilized StreamReader abstraction changes
May 10, 2017
1f865bf
Fix errors and golint warnings
May 11, 2017
d9e62af
Fix more errors
May 11, 2017
4b69801
Fix a Nil reference exception
May 12, 2017
1acb629
Added a default queueDepth which was causing the listener to hang
May 13, 2017
7f564b2
Refactored StreamReader interface based on new design considerations.…
May 16, 2017
6edab84
Fixed golint errors. Implemented sendMessage function to write to st…
May 16, 2017
98dfd11
Call processAction from ensureClient. Handle decoding and unmarshall…
May 16, 2017
d41dd36
Fix gosimple error by simplifying error handling logic
May 16, 2017
af64e1a
Fix unmarshalling / base64 decoding step of the KCL Multilang Daemon'…
May 18, 2017
c408a5f
Added a custom unmarshaller to handle html angle brackets
May 18, 2017
cc09647
Fix gosimple error
May 18, 2017
6977a19
Merge pull request #45 from rewardStyle/version3_listener_unstable
May 19, 2017
f5a6907
Added a function to set the stream reader instead of setting the kine…
May 22, 2017
5cdc2a2
Git branching clean up
May 22, 2017
77f05e9
Added integration testing to test sending multiple messages through a…
May 25, 2017
28d14bd
Update glide files to pull in assertion package. Fix golint issues.
May 25, 2017
3282271
Adjust the kinetic producer / listener configs to fix race condition …
May 25, 2017
636b47d
Added sample application to create a stand-alone executable for runni…
May 26, 2017
90b6288
Fix golint errors
May 26, 2017
6a24e8e
Added exception logging and more code clean up
May 26, 2017
538f5b8
Refactored executable test program to add the ability to 1) stream to…
Jun 1, 2017
9702c17
Modified the README.md file to update usage examples for the producer…
Jun 2, 2017
a957c86
Added back KCL reader implementation and fixed bugs encountered when …
Jun 7, 2017
0bd3a3c
Producer refactor changes after team code review
Jun 13, 2017
baebb8a
Refactored kinetic to remove the association between the producer/wri…
Jun 22, 2017
251fc65
Modified the signature of PutRecords to accept a context variable and…
Jun 26, 2017
04d6790
Refactor readers and writers to have an AwsConfig field instead of us…
Jun 26, 2017
2381724
Renamed MessageFn to MessageHandler and created a new type called Mes…
Jun 27, 2017
76666ac
Upgraded to the latest version of the aws-sdk-go library and simplifi…
Jun 28, 2017
4217118
Fixed a bug with setting the batchSize to 500. Added validation logi…
Jun 29, 2017
75d9289
Simplified ReadCloserWrapper by removing the OnReadFn field which is …
Jul 5, 2017
8ad9b48
Make attempts counter in producer "thread safe". Changes to testexec…
Jul 6, 2017
eda4de4
Run gofmt.
Jul 6, 2017
2a6685c
Added a DefaultStatsCollector to both the listener package and the pr…
Jul 10, 2017
1d4a236
Fixed a bug with the producer's stats collection for the Sent and Fai…
Jul 10, 2017
99cb2e8
Converted magic strings for stats into constants and added missing st…
Jul 10, 2017
2e20f0c
Renamed the producer stats to make more sense.
Jul 11, 2017
b12dc44
Added new producer stats to the StatsCollector interface to capture r…
Jul 12, 2017
8f919fc
Initial commit of producer refactor based on producer redsign to 1) r…
Jul 18, 2017
1a8ec24
Fixed a bug that introduced nil messages into the workers retry messa…
Jul 18, 2017
0c6ec56
Removed the worker object entirely replaced it with a helper function…
Jul 19, 2017
a4f7a28
Clean up the command line arguments for the test executable and updat…
Jul 19, 2017
529ef19
Fixed a bug in the produce function where we weren't waiting for the …
Jul 19, 2017
19ebef5
Fixed broken unit test
Jul 19, 2017
f2159ad
Replaced the rateLimiter implementation with a golang library (github…
Jul 21, 2017
a685a90
Implemented shard monitoring for the kinesiswriter and the produce fu…
Jul 24, 2017
e26a55c
Added new stats to track the number of concurrent workers for the pro…
Jul 24, 2017
13421ee
Added more thorough error checking around rate limiting configuration…
Jul 24, 2017
c66a9e1
Added a data spill callback function as a configurable parameter.
Jul 25, 2017
b3f5a5f
Reset rate limiters upon a detected shard count change event.
Jul 25, 2017
9788d1e
Modified the rate limiting implementation in the produce function to …
Jul 25, 2017
c892a14
Minor refactor of listener to clean up a bit.
Jul 26, 2017
e100d7d
Added rate limiting to the listener. Added payload size as one of th…
Jul 27, 2017
385c90c
Remove glide files
Jul 27, 2017
efc4176
Eliminated uncessary packages by moving files around
Jul 27, 2017
e4a35be
Renamed listener to consumer. Introduced functional options for conf…
Jul 28, 2017
56194f7
Consolidated the producer and consumer packages into the main kinetic…
Jul 28, 2017
a61c732
Documented new data types and functions to fix golint errors. Fixed …
Jul 28, 2017
a6c3ba5
Regenerated glide.yaml and glide.lock files.
Jul 28, 2017
83b9b32
Fix vendoring issues.
Jul 28, 2017
adcd33a
Additional changes to glide.yaml file.
Jul 28, 2017
a352c0b
Refactored the produce/consumer constructor methods to not require a …
Jul 28, 2017
f7a09a8
Fix broken unit test
Jul 28, 2017
58b6aa2
Fix some megacheck errors and updated README.md files.
Jul 31, 2017
66a064f
Removed the WaitGroup argument from the messageHandler and MessagePro…
Aug 2, 2017
40157db
Refactor KclReader implementation to add startup and shutdown functio…
Aug 2, 2017
8c11d72
Added checkpointing in KclReader and exposed new functions through th…
Aug 11, 2017
9856250
Expose function option methods (KclReaderLogLevel and KclReaderStats)
Aug 14, 2017
80ea7c3
Renamed checkpoint to checkpointer. Removed capacity constraint on c…
Aug 18, 2017
da9aabc
Refactored the checkpointer implementation to use a doubly linked lis…
Aug 22, 2017
739e252
Refactored the signature of the function option methods to operate on…
Aug 23, 2017
c37399e
Added the ability to configure the KinesisReader's GetRecords concurr…
Aug 23, 2017
819161d
gofmt.
Aug 23, 2017
fcac48b
Remove Checkpoint methods from StreamReader interface.
Aug 23, 2017
1cd9bfb
Added documentation in doc.go and updated README.md file. Fixed a lo…
Aug 25, 2017
ed36ce9
Fix race condition in checkpoint_test.go that was causing tests to fail.
Aug 25, 2017
6a5bfe2
Moved the rate limiting logic from the Consumer to the KinesisReader.…
Aug 29, 2017
0176c83
Remove throttle function from KinesisReader as it is now redundant wi…
Aug 30, 2017
e8ffae2
Removed unnecessary CloseWithContext function.
Oct 2, 2017
116fb8c
strip out pipe of death
Oct 2, 2017
d48871e
Define reader as a bufio.NewReader that reads from STDIN
Oct 4, 2017
83c9709
FU staticcheck
Oct 4, 2017
bfbb8a2
staticcheck and gosimple site is down
Oct 4, 2017
3c41824
Added TeeReader for debugging
Oct 5, 2017
fde947e
Added TeeReader for debugging
Oct 5, 2017
e79cb77
Print errors with file creation
Oct 5, 2017
c08d8e4
Panic
Oct 5, 2017
854c5f6
Revert TeeReader stuff (for debugging) and fix megacheck errors.
Oct 6, 2017
4eaca88
Simplified Consumer.ListenWithContext by eliminatin the select statement
Oct 6, 2017
94e63ce
Uncomment out staticcheck and gosimple dependencies in circle.yml file.
Oct 9, 2017
e266d0a
Add default KclReader callback functions
Oct 9, 2017
3b561fa
Added a bufio writer for KclReader to write to Stdout.
Oct 27, 2017
e0d3689
Added function option methods for configuring the KclReader's reader/…
Oct 27, 2017
f3225b0
Change from fmt.Println to fmt.FPrintln to write to the correct io.Wr…
Oct 27, 2017
3efae98
Fix a bug where kcl_reader was writing to KCL twice.
Oct 27, 2017
46d513e
[LM-594] Fixed firehose writer timeout type
Mar 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 26 additions & 26 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,29 +1,3 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
kinetic.conf
*.o
*.a
*.so

# Folders
_obj
_test

# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out

*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*

_testmain.go

*.exe
*.test
*.prof

# Created by https://www.gitignore.io/api/vim

### Vim ###
Expand All @@ -37,3 +11,29 @@ Session.vim
*~
# auto-generated tag files
tags

# Created by https://www.gitignore.io/api/go

### Go ###
# Binaries for programs and plugins
*.exe
*.dll
*.so
*.dylib

# Test binary, build with `go test -c`
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/

# End of https://www.gitignore.io/api/go

# custom
# external packages folder
vendor/
.idea/*
kinetic.iml
61 changes: 29 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@
# kinetic
Kinetic is an MIT-licensed high-performance AWS Kinesis Client for Go

Kinetic wraps [sendgridlabs go-kinesis library](https://github.com/sendgridlabs/go-kinesis) to provide maximum throughput for AWS Kinesis producers and consumers.
An instance of a Kinetic listener/producer is meant to be used for each shard, so please use it accordingly. If you use more than one instance per-shard then you will
hit the AWS Kinesis throughput [limits](http://docs.aws.amazon.com/kinesis/latest/dev/service-sizes-and-limits.html).
Kinetic wraps [aws-sdk-go](https://github.com/aws/aws-sdk-go.git) to provide maximum throughput with built-in fault tolerance and retry logic for AWS Kinesis producers and consumers.
The Kinetic producer can write to Kinesis or Firehose and the Kinetic consumer can consume stream data from Kinesis using the aws-sdk-go or using the Kinesis client library (written in Java).

### Getting Started
Before using kinetic, you should make sure you have a created a Kinesis stream and your configuration file has the credentails necessary to read and write to the stream. Once this stream exists in AWS, kinetic will ensure it is in the "ACTIVE" state before running.


## Testing
Tests are written using [goconvey](http://goconvey.co/) and [kinesalite](https://github.com/mhart/kinesalite). Make sure you have kinesalite running locally before attempting to run the tests. They can be run either via the comamnd line:

Expand All @@ -31,45 +29,44 @@ Kinetic can be used to interface with kinesis like so:


```go
import "github.com/rewardStyle/kinetic"
import (
"github.com/rewardStyle/kinetic"
"sync"
)

// Create a kinetic object associated with a local kinesalite stream
k, _ := kinetic.NewKinetic(
kinetic.AwsConfigCredentials("some-access-key", "some-secret-key", "some-security-token"),
kinetic.AwsConfigRegion("some-region"),
kinetic.AwsConfigEndpoint(""http://127.0.0.1:4567""),
)

// Use configuration in /etc/kinetic.conf
listener, _ := new(kinetic.Listener).Init()
// Create a kinetic producer
p, _ := kinetic.NewProducer(k.Session.Config, "stream-name")

// Use custom configuration
producer, _ := new(kinetic.Producer).InitC("your-stream", "0", "shard-type", "accesskey", "secretkey", "region", 10)
// Create a kinetic consumer
c, err := kinetic.NewConsumer(k.Session.Config, "stream-name", "shard-name")

producer.Send(new(kinetic.Message).Init([]byte(`{"foo":"bar"}`), "test"))

// Using Retrieve
msg, err := listener.Retrieve()
// Retrieve one message using the consumer's Retrieve function
msg, err := c.Retrieve()
if err != nil {
println(err)
}

println(string(msg))

// Using Listen - will block unless sent in goroutine
go listener.Listen(func(msg []byte, wg *sync.WaitGroup) {
println(string(msg))
wg.Done()
go c.Listen(func(b []byte, wg *sync.WaitGroup){
defer wg.Done()

println(string(b))
})

producer.Send(new(KinesisMessage).Init([]byte(`{"foo":"bar"}`), "test"))

listener.Close()
producer.Close()

// Or with Kinesis Firehose
firehose, err := new(kinetic.Producer).Firehose()
if err != nil {
println(err)
}

firehose.Send(new(KinesisMessage).Init([]byte(`{"foo":"bar"}`), "test"))

firehose.Close()
// Send a message using the producer
p.Send(&kinetic.Message{
Data: []byte(`{"foo":"bar"}`),
})

```

For more examples take a look at the tests. API documentation can be found [here](https://godoc.org/github.com/rewardStyle/kinetic).
For more examples take a look at the tests or the test program in the `testexec` directory. For
additional information see the kinetic package documentation [here](https://godoc.org/github.com/rewardStyle/kinetic).
28 changes: 0 additions & 28 deletions auth.go

This file was deleted.

Loading