mirror of
https://github.com/absmach/supermq.git
synced 2026-06-23 06:50:18 +00:00
NOISSUE - Add script outputs (#121)
* Update RE to use pure Go instead of Lua bindings Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix RE DB Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix nil error case Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix adding query Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix constraints on kind and logic type Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Update RE to use multiple outputs Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Update PG writer output Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix protocol error in MQTT forwareder Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix rules error handings Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Add false value check Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix topic filtering Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix consumers Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix publisher Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix mocks Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> * Fix tests Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com> --------- Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
This commit is contained in:
+8
-5
@@ -176,9 +176,10 @@ func main() {
|
||||
}
|
||||
defer authnClient.Close()
|
||||
logger.Info("AuthN successfully connected to auth gRPC server " + authnClient.Secure())
|
||||
errs := make(chan error)
|
||||
|
||||
database := pgclient.NewDatabase(db, dbConfig, tracer)
|
||||
svc, err := newService(database, msgSub, writersPub, alarmsPub, ec, logger)
|
||||
svc, err := newService(database, errs, msgSub, writersPub, alarmsPub, ec, logger)
|
||||
if err != nil {
|
||||
logger.Error(fmt.Sprintf("failed to create services: %s", err))
|
||||
exitCode = 1
|
||||
@@ -200,8 +201,10 @@ func main() {
|
||||
|
||||
go func() {
|
||||
for {
|
||||
err := <-svc.Errors()
|
||||
logger.Warn("Error handling rule", slog.String("error", err.Error()))
|
||||
err := <-errs
|
||||
if err != nil {
|
||||
logger.Warn("Error handling rule", slog.String("error", err.Error()))
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
@@ -231,7 +234,7 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func newService(db pgclient.Database, rePubSub messaging.PubSub, writersPub, alarmsPub messaging.Publisher, ec email.Config, logger *slog.Logger) (re.Service, error) {
|
||||
func newService(db pgclient.Database, errs chan error, rePubSub messaging.PubSub, writersPub, alarmsPub messaging.Publisher, ec email.Config, logger *slog.Logger) (re.Service, error) {
|
||||
repo := repg.NewRepository(db)
|
||||
idp := uuid.New()
|
||||
|
||||
@@ -240,7 +243,7 @@ func newService(db pgclient.Database, rePubSub messaging.PubSub, writersPub, ala
|
||||
logger.Error(fmt.Sprintf("failed to configure e-mailing util: %s", err.Error()))
|
||||
}
|
||||
|
||||
csvc := re.NewService(repo, idp, rePubSub, writersPub, alarmsPub, re.NewTicker(time.Minute), emailerClient)
|
||||
csvc := re.NewService(repo, errs, idp, rePubSub, writersPub, alarmsPub, re.NewTicker(time.Minute), emailerClient)
|
||||
csvc = middleware.LoggingMiddleware(csvc, logger)
|
||||
|
||||
return csvc, nil
|
||||
|
||||
Reference in New Issue
Block a user