dynamodbkinsumer

package module
v0.0.0-...-9d8ab0d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 13 Imported by: 0

README

dynamodbstreams-kinsumer

timwu20 codecov

Provides the same functionality as DynamoDB Streams Kinesis Adapter but written in Go. This library does not depend on the Java MultiLangDaemon. Consuming and checkpointing is handled by Kinsumer.

Example

See kinsumer_integration_test.go for an example

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamoDBStreamsKinesisAdapter

type DynamoDBStreamsKinesisAdapter struct {
	// embed a pointer to Kinesis, will fulfill kinesisiface.KinesisAPI but panic if any methods
	// called are not explicitly implemented
	*kinesis.Kinesis
	// contains filtered or unexported fields
}

DynamoDBStreamsKinesisAdapter is an adapter for DynamoDB Streams to work with kinesisiface.kinesisAPI

func NewAdapter

NewAdapter returns a new DynamoDBStreamsKinesisAdapter

func (DynamoDBStreamsKinesisAdapter) DescribeStream

func (ddbska DynamoDBStreamsKinesisAdapter) DescribeStream(input *kinesis.DescribeStreamInput) (output *kinesis.DescribeStreamOutput, err error)

DescribeStream calls DynamoDBStreams.DescribeStream

func (DynamoDBStreamsKinesisAdapter) GetRecords

func (ddbska DynamoDBStreamsKinesisAdapter) GetRecords(input *kinesis.GetRecordsInput) (output *kinesis.GetRecordsOutput, err error)

GetRecords calls DynamoDBStreams.GetRecords

func (DynamoDBStreamsKinesisAdapter) GetShardIterator

func (ddbska DynamoDBStreamsKinesisAdapter) GetShardIterator(input *kinesis.GetShardIteratorInput) (output *kinesis.GetShardIteratorOutput, err error)

GetShardIterator calls DynamoDBStreams.GetShardIterator

func (DynamoDBStreamsKinesisAdapter) ListShards

ListShards calls DynamoDBStreamsKinesisAdapter.DescribeStreamOutput for Shards

type DynamoDBStreamsKinsumer

type DynamoDBStreamsKinsumer struct {
	*kinsumer.Kinsumer
}

DynamoDBStreamsKinsumer is a Kinsumer for DynamoDB Streams

func New

func New(tableName, partitionKey, applicationName, clientName string, config kinsumer.Config) (*DynamoDBStreamsKinsumer, error)

New returns a DynamoDBStreamsKinsumer

func NewWithInterfaces

func NewWithInterfaces(kinesis kinesisiface.KinesisAPI, dynamodb dynamodbiface.DynamoDBAPI, streamsAPI dynamodbstreamsiface.DynamoDBStreamsAPI, tableName, applicationName, clientName string, config kinsumer.Config) (*DynamoDBStreamsKinsumer, error)

NewWithInterfaces allows you to override the Kinesis, DynamoDB Streams and DynamoDB instances for mocking or using a local set of servers

func NewWithSession

func NewWithSession(session *session.Session, tableName, partitionKey, applicationName, clientName string, config kinsumer.Config) (*DynamoDBStreamsKinsumer, error)

NewWithSession should be used if you want to override the Kinesis and DynamoDB instances with a non-default aws session

func (*DynamoDBStreamsKinsumer) Next

func (ddbsk *DynamoDBStreamsKinsumer) Next() (streamRecord *StreamRecord, err error)

Next calls Kinsumer.Next() and will return a StreamRecord

type StreamRecord

type StreamRecord struct {
	ApproximateCreationDateTime *time.Time
	Keys                        map[string]*dynamodb.AttributeValue
	NewImage                    map[string]*dynamodb.AttributeValue
	OldImage                    map[string]*dynamodb.AttributeValue
	SequenceNumber              *string
	SizeBytes                   *int64
	StreamViewType              *string
}

StreamRecord is unmarshalled dynamodbstreams.StreamRecord

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL