kinesis-consumer/README.md

69 lines
2.2 KiB
Markdown
Raw Normal View History

# Golang Kinesis Connectors
2015-05-23 23:18:10 +00:00
__Kinesis connector applications written in Go__
2016-02-09 03:39:09 +00:00
> With the release of Kinesis Firehose I'd recommend using [Lambda Streams to Firehose](https://github.com/awslabs/lambda-streams-to-firehose) for loading data to S3 and Redshift.
2016-02-09 03:39:09 +00:00
Inspired by the [Amazon Kinesis Connector Library](https://github.com/awslabs/amazon-kinesis-connectors). This library is intended to be a lightweight wrapper around the Kinesis API to handle batching records, respecing ratelimits, setting checkpoints, and recovering gracefully from network errors.
2015-05-23 23:18:10 +00:00
![golang_kinesis_connector](https://cloud.githubusercontent.com/assets/739782/4262283/2ee2550e-3b97-11e4-8cd1-21a5d7ee0964.png)
## Overview
The consumer expects a handler func that will process a buffer of incoming records.
```golang
func main() {
var(
app = flag.String("app", "", "The app name")
stream = flag.String("stream", "", "The stream name")
)
flag.Parse()
c := connector.NewConsumer(*app, *stream)
c.Start(connector.HandlerFunc(func(b connector.Buffer) {
fmt.Println(b.GetRecords())
// process the records
}))
select {}
}
```
2015-05-23 20:57:52 +00:00
### Installation
Get the package source:
$ go get github.com/harlow/kinesis-connectors
2016-02-09 03:39:09 +00:00
### Examples
2015-05-23 23:10:08 +00:00
2016-02-09 03:39:09 +00:00
Use the [seed stream](https://github.com/harlow/kinesis-connectors/tree/master/examples/seed) code to put sample data onto the stream.
2015-05-23 23:10:08 +00:00
2016-02-09 03:39:09 +00:00
* [Firehose](https://github.com/harlow/kinesis-connectors/tree/master/examples/firehose)
* [S3](https://github.com/harlow/kinesis-connectors/tree/master/examples/s3)
2015-05-23 23:10:08 +00:00
2015-05-26 06:09:59 +00:00
### Logging
2015-05-26 06:18:14 +00:00
Default logging is handled by [go-kit package log](https://github.com/go-kit/kit/tree/master/log). Applications can override the default loging behaviour by implementing the [Logger interface][log_interface].
```go
connector.SetLogger(NewCustomLogger())
```
[log_interface]: https://github.com/harlow/kinesis-connectors/blob/master/logger.go
2015-05-23 23:18:10 +00:00
## Contributing
Please see [CONTRIBUTING.md] for more information. Thank you, [contributors]!
[LICENSE]: /MIT-LICENSE
[CONTRIBUTING.md]: /CONTRIBUTING.md
2015-05-23 23:18:10 +00:00
## License
Copyright (c) 2015 Harlow Ward. It is free software, and may
be redistributed under the terms specified in the [LICENSE] file.
[contributors]: https://github.com/harlow/kinesis-connectors/graphs/contributors