package service

import (
	"config-server/conf"

	"infish.cn/comm"
)

// 远程交互的nats链接
// 根据配置的adapter 建立busName和链接的映射
func RegisterProxyBus(config *conf.AppConf) map[string]*comm.NatsBus {
	adapters := make(map[string]*comm.NatsBus)
	aps := config.Adapter
	if aps == nil && len(aps) == 0 {
		return adapters
	}
	for _, v := range aps {
		conn, _ := comm.NewNatsBus3(v.Nats, 10000000, 5, []*comm.NatsStreamWather{})
		if conn != nil {
			adapters[v.BusName] = conn
		}
	}
	return adapters
}
