|
@@ -29,16 +29,16 @@ type CacheConfig struct {
|
|
|
}
|
|
|
|
|
|
type MessageQueueConfig struct {
|
|
|
- Redis *RedisConfig `json:"redis" yaml:"redis"`
|
|
|
- MaxLen int64 `json:"max_len" yaml:"max_len"`
|
|
|
- ConsumerNum int `json:"consumer_num" yaml:"consumer_num"`
|
|
|
+ Redis *RedisConfig `json:"redis" yaml:"redis"`
|
|
|
}
|
|
|
|
|
|
type RedisConfig struct {
|
|
|
- Address string `json:"address" yaml:"address"`
|
|
|
- UserName string `json:"user_name" yaml:"user_name"`
|
|
|
- Password string `json:"password" yaml:"password"`
|
|
|
- DB int `json:"db" yaml:"db"`
|
|
|
+ Address string `json:"address" yaml:"address"`
|
|
|
+ UserName string `json:"user_name" yaml:"user_name"`
|
|
|
+ Password string `json:"password" yaml:"password"`
|
|
|
+ DB int `json:"db" yaml:"db"`
|
|
|
+ MaxLen int64 `json:"max_len" yaml:"max_len"`
|
|
|
+ ConsumerNum int `json:"consumer_num" yaml:"consumer_num"`
|
|
|
}
|
|
|
|
|
|
// Infrastructure 基础设施结构
|
|
@@ -90,11 +90,10 @@ func NewInfrastructure(config Config) *Infrastructure {
|
|
|
// 初始化Redis消息队列
|
|
|
if config.MessageQueueConfig.Redis != nil {
|
|
|
redisConf := config.MessageQueueConfig.Redis
|
|
|
- maxLen := config.MessageQueueConfig.MaxLen
|
|
|
|
|
|
newRedisMessageQueue := redisMessageQueue.New(redisConf.Address, redisConf.UserName, redisConf.Password, redisConf.DB,
|
|
|
- messageQueueCommon.WithMaxLen(maxLen),
|
|
|
- messageQueueCommon.WithConsumerNum(config.ConsumerNum))
|
|
|
+ redisMessageQueue.WithMaxLen(redisConf.MaxLen),
|
|
|
+ redisMessageQueue.WithConsumerNum(redisConf.ConsumerNum))
|
|
|
|
|
|
i.redisMessageQueue = newRedisMessageQueue
|
|
|
}
|