Documentation ¶
Overview ¶
Package config defines the all the TubeMQ configuration options.
Index ¶
- Constants
- type Config
- type Option
- func WithAuth(enable bool, userName string, password string) Option
- func WithBoundConsume(sessionKey string, sourceCount int, selectBig bool, ...) Option
- func WithConsumePosition(consumePosition int) Option
- func WithConsumerMasters(masters string) Option
- func WithGroup(group string) Option
- func WithLogLevel(level string) Option
- func WithLogPath(path string) Option
- func WithMaxConfirmWait(d time.Duration) Option
- func WithMaxPartCheckPeriod(d time.Duration) Option
- func WithMaxSubInfoReportInterval(i int) Option
- func WithMsgNotFoundWait(d time.Duration) Option
- func WithPartCheckSlice(d time.Duration) Option
- func WithPartOffsets(partOffsets map[string]int64) Option
- func WithRPCReadTimeout(d time.Duration) Option
- func WithRebConfirmWait(d time.Duration) Option
- func WithSelectBig(selectBig bool) Option
- func WithShutdownRebWait(d time.Duration) Option
- func WithSourceCount(count int) Option
- func WithTLS(enable bool, certFile, keyFile, caFile, serverName string) Option
- func WithTopicFilters(topicFilters map[string][]string) Option
- func WithTopics(topics []string) Option
Constants ¶
View Source
const ( MaxRPCTimeout = 300000 * time.Millisecond MinRPCTimeout = 8000 * time.Millisecond MaxSessionKeyLen = 1024 MaxGroupLen = 1024 MaxTopicLen = 64 MaxFilterLen = 256 MaxFilterItemCount = 500 ConsumeFromFirstOffset = -1 ConsumeFromLatestOffset = 0 ConsumeFromMaxOffsetAlways = 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Net is the namespace for network-level properties used by broker and Master. Net struct { // ReadTimeout represents how long to wait for a response. ReadTimeout time.Duration // TLS based authentication with broker and master. TLS struct { // Enable represents whether or not to use TLS. Enable bool // CACertFile for TLS. CACertFile string // TLSCertFile for TLS. TLSCertFile string // TLSKeyFile for TLS. TLSKeyFile string // TTSServerName for TLS. TLSServerName string } // Auth represents the account based authentication with broker and master. Auth struct { // Enable represents whether or not to use authentication. Enable bool // Username for authentication. UserName string // Password for authentication. Password string } } // Producer is the namespace for configuration related to produce messages, // used by the producer Producer struct { // Masters is the addresses of master. Masters string // Topics of the production. Topics []string // MaxPubInfoReportInterval is maximum interval for the client to report publish information. MaxPubInfoInterval int } // Consumer is the namespace for configuration related to consume messages, // used by the consumer Consumer struct { // Masters is the addresses of master. Masters string // Topics of the consumption. Topics []string // TopicFilters is the map of topic to filters. TopicFilters map[string][]string // PartitionOffset is the map of partition to its corresponding offset. PartitionOffset map[string]int64 // ConsumerPosition is the initial offset to use if no offset was previously committed. ConsumePosition int // Group is the consumer group name. Group string // BoundConsume represents whether or not to specify the offset. BoundConsume bool // SessionKey is defined by the client. // The session key will be the same in a batch. SessionKey string // SourceCount is the number of consumers in a batch. SourceCount int // SelectBig specifies if multiple consumers want to reset the offset of the same partition, // whether or not to use the biggest offset. // The server will use the biggest offset if set, otherwise the server will use the smallest offset. SelectBig bool // RollbackIfConfirmTimeout represents if the confirm request timeouts, // whether or not this batch of data should be considered as successful. // This batch of data will not be considered as successful if set. RollbackIfConfirmTimeout bool // MaxSubInfoReportInterval is maximum interval for the client to report subscription information. MaxSubInfoReportInterval int // MaxPartCheckPeriod is the maximum interval to check the partition. MaxPartCheckPeriod time.Duration // PartCheckSlice is the interval to check the partition. PartCheckSlice time.Duration // MsgNotFoundWait is the maximum wait time the offset of a partition has reached the maximum offset. MsgNotFoundWait time.Duration // RebConfirmWait represents how long to wait // when the server is rebalancing and the partition is being occupied by the client. RebConfirmWait time.Duration // MaxConfirmWait is the maximum wait time a partition consumption command is released. MaxConfirmWait time.Duration // ShutdownRebWait represents how long to wait when shutdown is called and the server is rebalancing. ShutdownRebWait time.Duration } // Heartbeat is the namespace for configuration related to heartbeat messages, // used by the consumer Heartbeat struct { // Interval represents how frequently to send heartbeat. Interval time.Duration // MaxRetryTimes is the total number of times to retry sending heartbeat. MaxRetryTimes int // AfterFail is the heartbeat timeout after a heartbeat failure. AfterFail time.Duration } // Log is the namespace for configuration related to log messages, // used by the logger Log struct { // LogPath represents the path where the log save in LogPath string // LogLevel represents the level of log LogLevel string } }
Config defines multiple configuration options. Refer to: https://github.com/apache/inlong/blob/3249de37acf054a9c43677131cfbb09fc6d366d1/tubemq-client/src/main/java/org/apache/tubemq/client/config/ConsumerConfig.java
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig returns a default config of the client.
func ParseAddress ¶
ParseAddress parses the address to user-defined config.
func (*Config) ValidateConsumer ¶
ValidateConsumer validates the config of the consumer.
func (*Config) ValidateProducer ¶
ValidateProducer valiates the config of the producer.
type Option ¶
type Option func(*Config)
func WithBoundConsume ¶
func WithConsumePosition ¶
func WithConsumerMasters ¶
func WithMaxConfirmWait ¶
func WithMaxPartCheckPeriod ¶
func WithMsgNotFoundWait ¶
func WithPartCheckSlice ¶
func WithPartOffsets ¶
func WithRPCReadTimeout ¶
func WithRebConfirmWait ¶
func WithSelectBig ¶
func WithShutdownRebWait ¶
func WithSourceCount ¶
func WithTopicFilters ¶
func WithTopics ¶
Click to show internal directories.
Click to hide internal directories.