feat: use names for connections to the nats event bus

This commit is contained in:
Juan Pablo Villafáñez
2025-09-08 17:32:35 +02:00
committed by Jörn Friedrich Dreyer
parent df10de7498
commit ca2dc823ef
18 changed files with 91 additions and 19 deletions
@@ -1,6 +1,7 @@
package command
import (
"github.com/opencloud-eu/opencloud/pkg/generators"
"github.com/opencloud-eu/opencloud/services/notifications/pkg/config"
"github.com/opencloud-eu/reva/v2/pkg/events"
"github.com/opencloud-eu/reva/v2/pkg/events/stream"
@@ -31,7 +32,8 @@ func SendEmail(cfg *config.Config) *cli.Command {
if !daily && !weekly {
return errors.New("at least one of '--daily' or '--weekly' must be set")
}
s, err := stream.NatsFromConfig(cfg.Service.Name, false, stream.NatsConfig(cfg.Notifications.Events))
connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS)
s, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Notifications.Events))
if err != nil {
return err
}
+3 -1
View File
@@ -17,6 +17,7 @@ import (
"github.com/opencloud-eu/reva/v2/pkg/rgrpc/todo/pool"
"github.com/opencloud-eu/opencloud/pkg/config/configlog"
"github.com/opencloud-eu/opencloud/pkg/generators"
"github.com/opencloud-eu/opencloud/pkg/registry"
"github.com/opencloud-eu/opencloud/pkg/service/grpc"
"github.com/opencloud-eu/opencloud/pkg/tracing"
@@ -94,7 +95,8 @@ func Server(cfg *config.Config) *cli.Command {
registeredEvents[typ.String()] = e
}
client, err := stream.NatsFromConfig(cfg.Service.Name, false, stream.NatsConfig(cfg.Notifications.Events))
connName := generators.GenerateConnectionName(cfg.Service.Name, generators.NTYPE_BUS)
client, err := stream.NatsFromConfig(connName, false, stream.NatsConfig(cfg.Notifications.Events))
if err != nil {
return err
}