prototube

package module
v0.0.0-...-4b37dec Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

README

Prototube

Build Status

Prototube is a minimal library that enables applications to emit typed messages to a Kafka topic. Users define the schemas of the messages with the Protobuf IDL. Prototube encodes the messages and pushes them to the specified Kafka topic.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncProducer

type AsyncProducer struct {
	// contains filtered or unexported fields
}

AsyncProducer struct

func (*AsyncProducer) Emit

func (p *AsyncProducer) Emit(msg proto.Message) error

Emit a new log in PB format to the stream with the current timestamp

func (*AsyncProducer) EmitWithBytesKey

func (p *AsyncProducer) EmitWithBytesKey(key []byte, msg proto.Message) error

EmitWithBytesKey emit a new log in PB format to the keyed stream with the current timestamp

func (*AsyncProducer) EmitWithPartition

func (p *AsyncProducer) EmitWithPartition(partition int32, msg proto.Message) error

EmitWithPartition a new log in PB format to the given stream partition with the current timestamp

func (*AsyncProducer) EmitWithStringKey

func (p *AsyncProducer) EmitWithStringKey(key string, msg proto.Message) error

EmitWithStringKey emit a new log in PB format to the keyed stream with the current timestamp

func (*AsyncProducer) Stop

func (p *AsyncProducer) Stop() error

Stop stop the producer

type Producer

type Producer interface {
	Stop() error
	Emit(msg proto.Message) error
	EmitWithStringKey(key string, msg proto.Message) error
	EmitWithBytesKey(key []byte, msg proto.Message) error
	EmitWithPartition(partition int32, msg proto.Message) error
}

Producer a event log producer that pushes events into Kinesis stream.

func New

func New(topic string) (Producer, error)

New create a new producer for the specified topic

func NewProducer

func NewProducer(conf *ProducerConfig) (Producer, error)

NewProducer create a new producer for the specified topic

type ProducerConfig

type ProducerConfig struct {
	Topic  string
	IsSync bool
	Config *sarama.Config
}

type SyncProducer

type SyncProducer struct {
	// contains filtered or unexported fields
}

SyncProducer struct

func (*SyncProducer) Emit

func (p *SyncProducer) Emit(msg proto.Message) error

Emit a new log in PB format to the stream with the current timestamp

func (*SyncProducer) EmitWithBytesKey

func (p *SyncProducer) EmitWithBytesKey(key []byte, msg proto.Message) error

EmitWithBytesKey emit a new log in PB format to the keyed stream with the current timestamp

func (*SyncProducer) EmitWithPartition

func (p *SyncProducer) EmitWithPartition(partition int32, msg proto.Message) error

EmitWithPartition a new log in PB format to the given stream partition with the current timestamp

func (*SyncProducer) EmitWithStringKey

func (p *SyncProducer) EmitWithStringKey(key string, msg proto.Message) error

EmitWithStringKey emit a new log in PB format to the keyed stream with the current timestamp

func (*SyncProducer) Stop

func (p *SyncProducer) Stop() error

Stop stop the producer

Directories

Path Synopsis
internal
idl

Jump to

Keyboard shortcuts

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