firequeue is to ensure putting items to Amazon Kinesis Data Firehose with an in-memory queue
import (
"context"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/firehose"
)
func main() {
sess := session.Must(session.NewSession())
fh := firehose.New(sess)
fq := firequeue.New(fh, "DELIVERY_STREAM_NAME")
ctx := context.Background()
go fq.Loop(ctx) // We should start looping before sending items
err := fq.Enqueue(&firehose.Record{...})
...
}
The firequeue utilizes an in-memory queue to ensure input to Amazon Kinesis Data Firehose. When the looping process is cancelled by the context, the firequeue wait for the queue to be empty and then exit the loop.
% go get github.com/natureglobal/firequeue