kafka

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GossipOriginalBlock = "original_block"

	OriginalBlockTopicFormat = GossipOriginalBlock
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BrokerList          []string
	GroupID             string
	InitialSyncComplete chan struct{}
}

type Consumer

type Consumer interface {
	Consumer() sarama.ConsumerGroup
}

type Kafka

type Kafka interface {
	StreamProvider
	TopicProvider
	Producer
	Consumer
}

type Producer

type Producer interface {
	Producer() sarama.SyncProducer
}

type Service

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

func NewKafkaService

func NewKafkaService(ctx context.Context, cfg *Config) (*Service, error)

func (*Service) Consumer

func (s *Service) Consumer() sarama.ConsumerGroup

func (*Service) JoinTopic

func (s *Service) JoinTopic(topic string) (string, error)

func (*Service) LeaveTopic

func (s *Service) LeaveTopic(topic string) error

func (*Service) Produce

func (s *Service) Produce(msg []byte) error

func (*Service) ProduceToTopic

func (s *Service) ProduceToTopic(ctx context.Context, topic string, data []byte) error

func (*Service) Producer

func (s *Service) Producer() sarama.SyncProducer

func (*Service) Start

func (s *Service) Start()

func (*Service) Stop

func (s *Service) Stop() error

func (*Service) SubscribeToTopic

func (s *Service) SubscribeToTopic(topic string) (string, error)

현재 미완

type StreamProvider

type StreamProvider interface {
	Produce([]byte) error
}

type TopicProvider

type TopicProvider interface {
	JoinTopic(topic string) (string, error)
	LeaveTopic(topic string) error
	ProduceToTopic(ctx context.Context, topic string, data []byte) error
	SubscribeToTopic(topic string) (string, error)
}

Jump to

Keyboard shortcuts

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