conf

package
v0.0.0-...-3b4426b Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ASYNC = 0
	SYNC  = 1
)

Variables

View Source
var (
	// Language define the current sdk language
	Language = "GO"
	// ProtocolDesc the protocol type
	ProtocolDesc = "grpc"

	// ProtocolVersion version for current sdk used
	ProtocolVersion = "1.0"
)

Functions

func ValidateDefaultConf

func ValidateDefaultConf(cfg *GRPCConfig) error

ValidateDefaultConf set the default configuration if user not provided check the conf which is required, and return not nil with parameter error

Types

type ConsumerConfig

type ConsumerConfig struct {
	// Enabled enable subscribe
	Enabled bool
	// ConsumerGroup uniq consumergroup for current client
	ConsumerGroup string
	// PoolSize goroutine pool to dispatch msg for a topic
	PoolSize int
	// Timeout in handle received msg
	// default to 5s
	Timeout time.Duration
}

ConsumerConfig consumer configuration, include subscribe configurations

type GRPCConfig

type GRPCConfig struct {
	// Hosts about the target eventmesh server
	Host string `validator:"required"`
	// Port port for eventmesh server
	Port int `validator:"required"`
	// ENV environment for client
	ENV string
	// Region always be the location
	Region string
	// IDC idc district
	IDC string
	// SYS system name
	SYS string
	// Username to access the eventmesh
	Username string
	// Password to access the eventmesh
	Password string
	// ProtocolType the type for current protocol
	ProtocolType string
	// ConsumerConfig if the client is listen some event
	// optional
	ConsumerConfig

	// ProducerConfig if the client need to send message
	// you should configure it
	// optional
	ProducerConfig

	// HeartbeatConfig heartbeat configuration
	HeartbeatConfig
}

GRPCConfig grpc configuration

type HeartbeatConfig

type HeartbeatConfig struct {
	// Period duration to send heartbeat
	// default to 5s
	Period time.Duration
	// Timeout ticker in send heartbeat msg
	// default to 3s
	Timeout time.Duration
}

HeartbeatConfig heartbeat configuration required

type LoadBalancerType

type LoadBalancerType string

LoadBalancerType type for LoadBalancer

var (
	Random     LoadBalancerType = "random"
	RoundRobin LoadBalancerType = "roundrobin"
	IPHash     LoadBalancerType = "iphash"
)

type ProducerConfig

type ProducerConfig struct {
	// LoadBalancerType load balancer type, support random/roundrobin/iphash
	LoadBalancerType LoadBalancerType
	// ProducerGroup uniq consumer group for current client
	ProducerGroup string
}

ProducerConfig configuration producer

type SubscribeItem

type SubscribeItem struct {
	// Topic uniq for eventmesh
	Topic string
	// SubscribeType type for subscribe, support as fellow
	SubscribeType SubscriptionType
	// SubscribeMode mode for subscribe, support as fellow
	SubscribeMode SubscriptionMode
}

SubscribeItem content about subscribe

type SubscriptionMode

type SubscriptionMode int
const (
	CLUSTERING   SubscriptionMode = 0
	BROADCASTING SubscriptionMode = 1
)

type SubscriptionType

type SubscriptionType int

Jump to

Keyboard shortcuts

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