infra

package
v0.0.0-...-9cad258 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Driver = "postgres"
	DSN    = "postgres://$SVC_DB_USER_NAME:$SVC_DB_PASSWORD@$SVC_DB_HOST:$SVC_DB_PORT/$SVC_DB_DATABASE?sslmode=disable"
)
View Source
const (
	KafkaAddr    = "$SVC_KAFKA_HOST:$SVC_KAFKA_PORT"
	KafkaGroupID = "$SVC_KAFKA_GROUP_ID"
)

Variables

This section is empty.

Functions

func NewDB

func NewDB() (*sql.DB, func(), error)

func RunHTTPServer

func RunHTTPServer(ctx context.Context, addr string, handler http.Handler) error

Types

type KafkaHandler

type KafkaHandler interface {
	HandleMessage(context.Context, []byte) error
}

type KafkaHandlerFunc

type KafkaHandlerFunc func(context.Context, []byte) error

func (KafkaHandlerFunc) HandleMessage

func (f KafkaHandlerFunc) HandleMessage(ctx context.Context, msg []byte) error

type KafkaProcessor

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

func NewKafkaProcessor

func NewKafkaProcessor() (*KafkaProcessor, error)

func (*KafkaProcessor) Close

func (c *KafkaProcessor) Close()

func (*KafkaProcessor) RegisterHandler

func (c *KafkaProcessor) RegisterHandler(topic string, handler KafkaHandler)

func (*KafkaProcessor) RegisterHandlerFunc

func (c *KafkaProcessor) RegisterHandlerFunc(topic string, handler func(context.Context, []byte) error)

func (*KafkaProcessor) Start

func (c *KafkaProcessor) Start(ctx context.Context)

type KafkaSender

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

func NewKafkaSender

func NewKafkaSender() (*KafkaSender, error)

func (*KafkaSender) Close

func (s *KafkaSender) Close()

func (*KafkaSender) Send

func (s *KafkaSender) Send(topic string, msg []byte) error

type SimpleConsumerGroupHandler

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

func NewSimpleConsumerGroupHandler

func NewSimpleConsumerGroupHandler(processor KafkaHandler) *SimpleConsumerGroupHandler

func (SimpleConsumerGroupHandler) Cleanup

func (SimpleConsumerGroupHandler) ConsumeClaim

func (c SimpleConsumerGroupHandler) ConsumeClaim(
	session sarama.ConsumerGroupSession,
	claim sarama.ConsumerGroupClaim,
) (err error)

func (SimpleConsumerGroupHandler) Setup

Jump to

Keyboard shortcuts

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