helper

package
v0.0.0-...-70a76fe Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBambooWorker

func CreateBambooWorker(cfg *WorkerConfig, workerFunc bamboo.WorkerFunc) (bamboo.BambooWorker, error)

func InitLog

func InitLog(env string, cfg *LogConfig) error

func InitTracerProvider

func InitTracerProvider(appName string, traceConfig *TraceConfig) (*sdktrace.TracerProvider, error)

func LogConfigFunc

func LogConfigFunc(ctx context.Context, headers map[string]string) context.Context

Types

type BambooPrameter

type BambooPrameter interface {
	ToBytes() ([]byte, error)
}

type ConsumerConfig

type ConsumerConfig struct {
	Type  string               `yaml:"type" validate:"required"`
	Kafka *KafkaConsumerConfig `yaml:"kafka"`
	Redis *RedisConsumerConfig `yaml:"redis"`
}

type JaegerConfig

type JaegerConfig struct {
	Endpoint string `yaml:"endpoint" validate:"required"`
}

type KafkaConsumerConfig

type KafkaConsumerConfig struct {
	Brokers []string `yaml:"brokers" validate:"required"`
	GroupID string   `yaml:"groupId" validate:"required"`
	Topic   string   `yaml:"topic" validate:"required"`
}

type KafkaRequestProducerConfig

type KafkaRequestProducerConfig struct {
	Addr  string `yaml:"addr" validate:"required"`
	Topic string `yaml:"topic" validate:"required"`
}

type LogConfig

type LogConfig struct {
	Level string `yaml:"level"`
}

type PublisherConfig

type PublisherConfig struct {
	Type  string                `yaml:"type" validate:"required"`
	Redis *RedisPublisherConfig `yaml:"redis"`
}

type RedisConsumerConfig

type RedisConsumerConfig struct {
	Addrs    []string `yaml:"addrs" validate:"required"`
	Password string   `yaml:"password"`
	Channel  string   `yaml:"channel" validate:"required"`
}

type RedisPublisherConfig

type RedisPublisherConfig struct {
	Addrs    []string `yaml:"addrs" validate:"required"`
	Password string   `yaml:"password"`
}

type RedisRequestProducerConfig

type RedisRequestProducerConfig struct {
	Addrs    []string `yaml:"addrs" validate:"required"`
	Password string   `yaml:"password"`
	Channel  string   `yaml:"channel" validate:"required"`
}

type RedisResultSubscriberConfig

type RedisResultSubscriberConfig struct {
	Addrs    []string `yaml:"addrs" validate:"required"`
	Password string   `yaml:"password"`
}

result

type RequestProducerConfig

type RequestProducerConfig struct {
	Type  string                      `yaml:"type" validate:"required"`
	Kafka *KafkaRequestProducerConfig `yaml:"kafka"`
	Redis *RedisRequestProducerConfig `yaml:"redis"`
}

request

type ResultSubscriberConfig

type ResultSubscriberConfig struct {
	Type  string                       `yaml:"type" validate:"required"`
	Redis *RedisResultSubscriberConfig `yaml:"redis"`
}

type StandardClient

type StandardClient struct {
	Clients map[string]WorkerClient
}

func (*StandardClient) Call

func (c *StandardClient) Call(ctx context.Context, clientName string, heartbeatIntervalSec int, jobTimeoutSec int, headers map[string]string, param []byte) ([]byte, error)

type TraceConfig

type TraceConfig struct {
	Exporter string        `yaml:"exporter" validate:"required"`
	Jaeger   *JaegerConfig `yaml:"jaeger"`
}

type WorkerClient

type WorkerClient interface {
	Produce(ctx context.Context, resultChannel string, heartbeatIntervalSec int, jobTimeoutSec int, headers map[string]string, data []byte) error
	Subscribe(ctx context.Context, resultChannel string, heartbeatIntervalSec int, jobTimeoutSec int) ([]byte, error)
	Ping(ctx context.Context) error
	Close(ctx context.Context)
}

func CreateWorkerClient

func CreateWorkerClient(ctx context.Context, workerName string, cfg *WorkerClientConfig, propagator propagation.TextMapPropagator) WorkerClient

func NewWorkerClient

func NewWorkerClient(rp bamboo.BambooRequestProducer, rs bamboo.BambooResultSubscriber) WorkerClient

type WorkerClientConfig

type WorkerClientConfig struct {
	RequestProducer  *RequestProducerConfig  `yaml:"requestProducer" validate:"required"`
	ResultSubscriber *ResultSubscriberConfig `yaml:"resultSubscriber" validate:"required"`
}

client

type WorkerConfig

type WorkerConfig struct {
	Consumer   *ConsumerConfig  `yaml:"consumer"`
	Publisher  *PublisherConfig `yaml:"publisher"`
	NumWorkers int              `yaml:"numWorkers"`
}

worker

Jump to

Keyboard shortcuts

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