Example #1
0
File: list.go Project: jamtur01/ktk
// List the names of all of the Kinesis streams.
func runList(args []string) {
	// Ignore args

	streams, err := listStreams(kinesis.New(nil))
	fatalOnErr(err)

	for _, stream := range streams {
		log.Println(stream)
	}
}
Example #2
0
// Start a consumer at the given Stream's LATEST and process each shard with
// processor.
//
// Each shard will be processed in an individual goroutine.
func Tail(stream string, debug bool, processor Processor) error {
	c := &Consumer{
		stream:    aws.String(stream),
		client:    kinesis.New(nil),
		processor: processor,

		debug: debug,

		complete:   make(chan string),
		waiterFunc: func() waiter { return &realWaiter{} },
	}

	return c.tail()
}
Example #3
0
// Create a new Producer with the max Kinesis send size and the default AWS
// Kinesis client. Any Kinesis InternalFailures or
// ProvisionedThroughputExceededExceptions will be retried automatically until
// they succeed, using an exponential backoff.
//
// To configure a client more fully, set SendSize and Client before usage. They
// *must* be set before the first call to Put, otherwise behavior is undefined.
// SendSize must be >= 0 and <= MaxSendSize.
func New(stream string) *Producer {
	return &Producer{
		StreamName: stream,
		SendSize:   MaxSendSize,
		client:     kinesis.New(nil),
		messages:   make([]message, MaxSendSize),
		Throttle: func() Throttle {
			return &exponentialThrottle{
				unit:    time.Millisecond,
				waitFor: 500,
				maxWait: 10000,
			}
		},
	}
}