config

package
v0.0.0-...-1897b02 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BrokerConfig

type BrokerConfig struct {
	Port                               int    `toml:"port"`                                   // broker对外提供服务端口
	IP                                 string `toml:"ip"`                                     // 本机ip地址
	DeleteWhen                         int    `toml:"delete_when"`                            // 何时触发删除无效Message
	AutoCreateTopicEnable              bool   `toml:"auto_create_topic_enable"`               // 是否允许客户端自动创建Topic(生产环境建议关闭)
	Permission                         int    `toml:"permission"`                             // Broker权限
	DefaultTopicQueueNums              int32  `toml:"default_topic_queue_nums"`               // 默认topic队列数
	ClusterTopicEnable                 bool   `toml:"cluster_topic_enable"`                   // 自动创建以集群名字命名的Topic功能是否开启
	BrokerTopicEnable                  bool   `toml:"broker_topic_enable"`                    // 自动创建以服务器名字命名的Topic功能是否开启
	AutoCreateSubscriptionGroup        bool   `toml:"auto_create_subscription_group"`         // 自动创建订阅组功能是否开启(线上建议关闭)
	FlushConsumerOffsetInterval        int    `toml:"flush_consumer_offset_interval"`         // 刷新ConsumerOffest定时间隔
	FlushConsumerOffsetHistoryInterval int    `toml:"flush_consumer_offset_history_interval"` // 此字段目前没有使用
	RejectTransactionMessage           bool   `toml:"reject_transaction_message"`             // 是否拒绝接收事务消息
	FetchNameSrvAddrByAddressServer    bool   `toml:"fetch_namesrv_addr_by_address_server"`   // 是否从地址服务器寻找NameServer地址,正式发布后,默认值为false
	SendThreadPoolQueueCapacity        int    `toml:"send_thread_pool_queue_capacity"`        // 发送消息对应的线程池阻塞队列size
	PullThreadPoolQueueCapacity        int    `toml:"pull_thread_pool_queue_capacity"`        // 订阅消息对应的线程池阻塞队列size
	FilterServerNums                   int32  `toml:"filter_server_nums"`                     // 过滤服务器数量
	LongPollingEnable                  bool   `toml:"long_polling_enable"`                    // Consumer订阅消息时,Broker是否开启长轮询
	ShortPollingTimeMills              int    `toml:"short_polling_timemills"`                // 如果是短轮询,服务器挂起时间
	NotifyConsumerIdsChangedEnable     bool   `toml:"notify_consumer_ids_changed_enable"`     // notify consumerId changed 开关
	OffsetCheckInSlave                 bool   `toml:"offset_check_in_slave"`                  // slave 是否需要纠正位点
	HaMasterAddress                    string `toml:"ha_master_addr"`                         // 适用场景:HA功能配置(将slave角色的 ha地址,指向master角色)
}

BrokerConfig

type ClusterConfig

type ClusterConfig struct {
	Name         string   `toml:"name"`          // 集群名称
	BrokerId     int64    `toml:"broker_id"`     // broker id
	BrokerName   string   `toml:"broker_name"`   // broker名称
	BrokerRole   string   `toml:"broker_role"`   // broker角色 主/备
	HaServerIP   string   `toml:"ha_server_ip"`  // 主备配置
	NameSrvAddrs []string `toml:"namesrv_addrs"` // Namesrv地址
}

ClusterConfig 集群配置

type Config

type Config struct {
	MQHome  string        `toml:"-"`       // BoltMQ安装运行路径
	CfgPath string        `toml:"-"`       // BoltMQ配置文件路径
	Cluster ClusterConfig `toml:"cluster"` // 集群配置
	Broker  BrokerConfig  `toml:"broker"`  // 参数配置
	Store   StoreConfig   `toml:"store"`   // store数据存储目录
	Log     LogConfig     `toml:"log"`     // 日志
}

func ParseConfig

func ParseConfig(path string) (*Config, error)

ParseConfig 解析配置文件

func (*Config) HasReadable

func (cfg *Config) HasReadable() bool

HasReadable 校验Broker是否有读权限 Author: tianyuliang Since: 2017/9/29

func (*Config) HasWriteable

func (cfg *Config) HasWriteable() bool

func (*Config) String

func (cfg *Config) String() string

String

type LogConfig

type LogConfig struct {
	CfgFilePath string `toml:"config_file_path"` // 日志配置文件路径
}

LogConfig 日志配置

type StoreConfig

type StoreConfig struct {
	RootDir          string `toml:"root_dir"`           // store的数据存储目录
	FlushDiskType    string `toml:"flush_disk_type"`    // 刷盘方式
	FileReservedTime int    `toml:"file_reserved_time"` // 消息保存时间
}

StoreConfig 存储相关配置

Jump to

Keyboard shortcuts

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