Skip to content

Commit

Permalink
fix nats subject map for endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
janishar committed Jul 1, 2024
1 parent 8803d28 commit 973e598
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion arch/micro/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ func (r *router) LoadControllers(controllers []Controller) {
natsClient := r.natsClient.GetInstance()

for _, c := range controllers {
baseSub := fmt.Sprintf(`%s.%s`, natsClient.Service.Info().Name, strings.ReplaceAll(c.Path(), "/", ""))
baseSub := natsClient.Service.Info().Name
endpoint := strings.ReplaceAll(c.Path(), "/", ".")
if len(endpoint) > 1 {
baseSub = fmt.Sprintf(`%s%s`, baseSub, endpoint)
}

ng := natsClient.Service.AddGroup(baseSub)
c.MountNats(ng)
Expand Down

0 comments on commit 973e598

Please sign in to comment.