Configuration NATS
This commit is contained in:
@@ -61,7 +61,7 @@ func (s State) String() string {
|
||||
type API struct{}
|
||||
|
||||
func (a *API) Discovered(infos []*beego.ControllerInfo) {
|
||||
respondToDiscovery := func(m map[string]interface{}) {
|
||||
respondToDiscovery := func(m map[string]string) {
|
||||
if len(m) == 0 {
|
||||
a.SubscribeRouter(infos)
|
||||
}
|
||||
@@ -91,8 +91,10 @@ func (a *API) GetState() (State, int, error) {
|
||||
return ALIVE, 200, nil // If everything is up, return alive
|
||||
}
|
||||
|
||||
func (a *API) ListenRouter(exec func(msg map[string]interface{})) {
|
||||
go NewNATSCaller().ListenNats(DISCOVERY.GenerateKey("api"), exec)
|
||||
func (a *API) ListenRouter(exec func(msg map[string]string)) {
|
||||
go NewNATSCaller().ListenNats(DISCOVERY.GenerateKey(), map[NATSMethod]func(msg map[string]string){
|
||||
DISCOVERY: exec,
|
||||
})
|
||||
}
|
||||
|
||||
func (a *API) SubscribeRouter(infos []*beego.ControllerInfo) {
|
||||
|
||||
Reference in New Issue
Block a user