bekafka

package
v0.0.0-...-fe5c0f3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewProducer() (*Producer, grerrors.Error)
	NewWorker() (*Worker, grerrors.Error)
}

func NewClient

func NewClient(cfg *Config) Client

NewClient init bekafka client

type Config

type Config struct {
	BrokerUrl []string `json:"broker_url" mapstructure:"broker_url"`
}

type Producer

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

func (*Producer) Close

func (p *Producer) Close() grerrors.Error

Close close kafka producer

func (*Producer) SendMessage

func (p *Producer) SendMessage(topic, message string) grerrors.Error

SendMessage start sending message to kafka with topic

type Worker

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

func (*Worker) ConsumePartition

func (w *Worker) ConsumePartition(topic string, action func(topic, message string) WorkerStatus) grerrors.Error

ConsumePartition set waiting to receive kafka message from producer

type WorkerStatus

type WorkerStatus string
const (
	WorkerStatusSuccess   WorkerStatus = "success"
	WorkerStatusTerminate WorkerStatus = "terminate"
	WorkerStatusFail      WorkerStatus = "fail"
)

Jump to

Keyboard shortcuts

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