Documentation
¶
Index ¶
- Variables
- type AllGroup
- type Consumer
- type Counter
- type Group
- type Logger
- type Option
- func WithAggregation(a bool) Option
- func WithClient(client kinesisClient) Option
- func WithCounter(counter Counter) Option
- func WithGroup(group Group) Option
- func WithLogger(logger Logger) Option
- func WithMaxRecords(n int64) Option
- func WithScanInterval(d time.Duration) Option
- func WithShardClosedHandler(h ShardClosedHandler) Option
- func WithShardIteratorType(t string) Option
- func WithStore(store Store) Option
- func WithTimestamp(t time.Time) Option
- type Record
- type ScanFunc
- type ShardClosedHandler
- type Store
Constants ¶
This section is empty.
Variables ¶
var ErrSkipCheckpoint = errors.New("skip checkpoint")
ErrSkipCheckpoint is used as a return value from ScanFunc to indicate that the current checkpoint should be skipped skipped. It is not returned as an error by any function.
Functions ¶
This section is empty.
Types ¶
type AllGroup ¶
type AllGroup struct {
Store
// contains filtered or unexported fields
}
AllGroup is used to consume all shards from a single consumer. It caches a local list of the shards we are already processing and routinely polls the stream looking for new shards to process.
func NewAllGroup ¶
NewAllGroup returns an intitialized AllGroup for consuming all shards on a stream
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
Consumer wraps the interaction with the Kinesis stream
func New ¶
New creates a kinesis consumer with default settings. Use Option to override any of the optional attributes.
type Group ¶
type Group interface {
Start(ctx context.Context, shardc chan types.Shard)
GetCheckpoint(streamName, shardID string) (string, error)
SetCheckpoint(streamName, shardID, sequenceNumber string) error
}
Group interface used to manage which shard to process
type Logger ¶
type Logger interface {
Log(...interface{})
}
A Logger is a minimal interface to as a adaptor for external logging library to consumer
type Option ¶
type Option func(*Consumer)
Option is used to override defaults when creating a new Consumer
func WithAggregation ¶
func WithClient ¶
func WithClient(client kinesisClient) Option
WithClient overrides the default client
func WithCounter ¶
WithCounter overrides the default counter
func WithMaxRecords ¶
WithMaxRecords overrides the maximum number of records to be returned in a single GetRecords call for the consumer (specify a value of up to 10,000)
func WithScanInterval ¶
WithScanInterval overrides the scan interval for the consumer
func WithShardClosedHandler ¶
func WithShardClosedHandler(h ShardClosedHandler) Option
func WithShardIteratorType ¶
WithShardIteratorType overrides the starting point for the consumer
func WithTimestamp ¶
WithTimestamp overrides the starting point for the consumer
type Record ¶
Record wraps the record returned from the Kinesis library and extends to include the shard id.
type ScanFunc ¶
ScanFunc is the type of the function called for each message read from the stream. The record argument contains the original record returned from the AWS Kinesis library. If an error is returned, scanning stops. The sole exception is when the function returns the special value ErrSkipCheckpoint.
type ShardClosedHandler ¶
ShardClosedHandler is a handler that will be called when the consumer has reached the end of a closed shard. No more records for that shard will be provided by the consumer. An error can be returned to stop the consumer.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
consumer
command
|
|
|
consumer-dynamodb
command
|
|
|
consumer-mysql
command
|
|
|
consumer-postgres
command
|
|
|
consumer-redis
command
|
|
|
producer
command
|
|
|
internal
|
|
|
store
|
|
|
memory
The memory store provides a store that can be used for testing and single-threaded applications.
|
The memory store provides a store that can be used for testing and single-threaded applications. |