Skip to content

Commit

Permalink
[sync-api] create correct correlation ids
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Nov 17, 2023
1 parent 7fd60da commit d8a41cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions sda/cmd/syncapi/syncapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"syscall"
"time"

"github.com/google/uuid"
"github.com/gorilla/mux"
"github.com/neicnordic/sensitive-data-archive/internal/broker"
"github.com/neicnordic/sensitive-data-archive/internal/config"
Expand Down Expand Up @@ -172,8 +173,8 @@ func parseDatasetMessage(msg []byte) error {
if err != nil {
return fmt.Errorf("failed to marshal json messge: Reason %v", err)
}

if err := Conf.API.MQ.SendMessage(fmt.Sprintf("%v", time.Now().Unix()), Conf.Broker.Exchange, Conf.SyncAPI.IngestRouting, ingestMsg); err != nil {
corrID := uuid.New().String()
if err := Conf.API.MQ.SendMessage(corrID, Conf.Broker.Exchange, Conf.SyncAPI.IngestRouting, ingestMsg); err != nil {
return fmt.Errorf("failed to send ingest messge: Reason %v", err)
}

Expand All @@ -190,7 +191,7 @@ func parseDatasetMessage(msg []byte) error {
return fmt.Errorf("failed to marshal json messge: Reason %v", err)
}

if err := Conf.API.MQ.SendMessage(fmt.Sprintf("%v", time.Now().Unix()), Conf.Broker.Exchange, Conf.SyncAPI.AccessionRouting, finalizeMsg); err != nil {
if err := Conf.API.MQ.SendMessage(corrID, Conf.Broker.Exchange, Conf.SyncAPI.AccessionRouting, finalizeMsg); err != nil {
return fmt.Errorf("failed to send mapping messge: Reason %v", err)
}
}
Expand Down

0 comments on commit d8a41cc

Please sign in to comment.