Exemplo n.º 1
0
func (k *kinesis) newClient(endpoint, stream string) gokinesis.KinesisClient {
	client := gokinesis.NewWithEndpoint(gokinesis.NewAuth("BAD_ACCESS_KEY", "BAD_SECRET_KEY", "BAD_TOKEN"), conf.AWS.Region, endpoint)
	client.CreateStream(stream, 1)

	// Wait for stream to create
	<-time.After(1 * time.Second)

	return client
}
Exemplo n.º 2
0
// Firehose initializes a producer for Kinesis Firehose with the params supplied in the configuration file
func (p *Producer) Firehose() (*Producer, error) {
	if conf.Concurrency.Producer < 1 {
		return nil, ErrBadConcurrency
	}
	p.setConcurrency(conf.Concurrency.Producer)
	p.initChannels()
	auth, err := authenticate(conf.AWS.AccessKey, conf.AWS.SecretKey)
	p.kinesis = &kinesis{
		stream: conf.Firehose.Stream,
		client: gokinesis.NewWithEndpoint(auth, conf.AWS.Region, fmt.Sprintf(firehoseURL, conf.AWS.Region)),
	}
	if err != nil {
		return p, err
	}

	p.producerType = firehoseType

	return p.activate()
}
Exemplo n.º 3
0
// FirehoseC initializes a producer for Kinesis Firehose with the specified params
func (p *Producer) FirehoseC(stream, accessKey, secretKey, region string, concurrency int) (*Producer, error) {
	if concurrency < 1 {
		return nil, ErrBadConcurrency
	}
	if stream == "" {
		return nil, ErrNullStream
	}

	p.setConcurrency(concurrency)
	p.initChannels()
	auth, err := authenticate(accessKey, secretKey)
	p.kinesis = &kinesis{
		stream: stream,
		client: gokinesis.NewWithEndpoint(auth, region, fmt.Sprintf(firehoseURL, region)),
	}
	if err != nil {
		return p, err
	}

	p.producerType = firehoseType

	return p.activate()
}