MIT No Attribution

项目介绍

a8m/kinesis-producer 是一个托管在 GitHub 上的开源项目,主要使用 Go 编写,采用 MIT No Attribution 许可证,目前获得 150 个 Star、41 次 Fork。

仓库全名
a8m/kinesis-producer
开源许可证
MIT No Attribution
Star 数
150
Fork 数
41
未关闭 Issue
10

README 摘要

A KPL-like batch producer for Amazon Kinesis built on top of the official Go AWS SDK and using the same aggregation format that [KPL][kpl-url] use. Useful links [Documentation][godoc-url] [Aggregation format][aggregation-format-url] [Considerations When Using KPL Aggregation][kpl-aggregation] [Consumer De-aggregation][de-aggregation] Example Specifying logger implementation producer.Config takes an optional…

完整内容见 GitHub 原始 README 或本页 。

常见问题

kinesis-producer 用什么语言开发?

主要使用 Go 编写,采用 MIT No Attribution 许可证,目前有 150 个 Star。

kinesis-producer 可以免费商用吗?

仓库采用 MIT No Attribution 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 kinesis-producer 的源码?

可以直接克隆仓库:git clone https://github.com/a8m/kinesis-producer.git,默认分支为 master;安装与运行步骤见仓库 README。

kinesis-producer 最近还在维护吗?

仓库最近一次更新为 2024年9月16日,当前有 10 个未关闭 Issue;Star 数为 150,可作为社区活跃度的参考。

关于

An aggregated records producer for Amazon Kinesis

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
236
价值分
102
活跃状态
活跃

语言占比

Go

Release

README

Amazon kinesis producer Build status License GoDoc

A KPL-like batch producer for Amazon Kinesis built on top of the official Go AWS SDK
and using the same aggregation format that KPL use.

Example

package main

import (
	"time"

	"github.com/sirupsen/logrus"
	"github.com/a8m/kinesis-producer"
	"github.com/aws/aws-sdk-go/aws"
	"github.com/aws/aws-sdk-go/aws/session"
	"github.com/aws/aws-sdk-go/service/kinesis"
)

func main() {
	client := kinesis.New(session.New(aws.NewConfig()))
	pr := producer.New(&producer.Config{
		StreamName:   "test",
		BacklogCount: 2000,
		Client:       client
	})

	pr.Start()

	// Handle failures
	go func() {
		for r := range pr.NotifyFailures() {
			// r contains `Data`, `PartitionKey` and `Error()`
			log.Error(r)
		}
	}()

	go func() {
		for i := 0; i < 5000; i++ {
			err := pr.Put([]byte("foo"), "bar")
			if err != nil {
				log.WithError(err).Fatal("error producing")
			}
		}
	}()

	time.Sleep(3 * time.Second)
	pr.Stop()
}
Specifying logger implementation

producer.Config takes an optional logging.Logger implementation.

Using a custom logger
customLogger := &CustomLogger{}

&producer.Config{
  StreamName:   "test",
  BacklogCount: 2000,
  Client:       client,
  Logger:       customLogger,
}
Using logrus
import (
	"github.com/sirupsen/logrus"
	producer "github.com/a8m/kinesis-producer"
	"github.com/a8m/kinesis-producer/loggers"
)

log := logrus.New()

&producer.Config{
  StreamName:   "test",
  BacklogCount: 2000,
  Client:       client,
  Logger:       loggers.Logrus(log),
}

kinesis-producer ships with three logger implementations.

  • producer.Standard used the standard library logger
  • loggers.Logrus uses logrus logger
  • loggers.Zap uses zap logger

License

MIT

评论

暂无评论