This commit is contained in:
Piotr Biernat 2023-05-22 21:57:17 +02:00
parent 8fac6f7e61
commit 66acbb0cda
4 changed files with 10 additions and 10 deletions

View File

@ -8,6 +8,9 @@ build-image-dev:
build-image-prod:
- sh ${DEPLOY_DIR}/image-build.sh
push-image-dev:
- sh ${DEPLOY_DIR}/image-push.sh dev
push-image-prod:
- sh ${DEPLOY_DIR}/image-push.sh

View File

@ -53,7 +53,7 @@ func main() {
if err != nil {
log.Fatalf("Error connecting to %s:%d. Err: %v", logHost, logPort, err)
}
// defer logger.Close()
defer logger.Close()
flag.Usage = usage
flag.Parse()

View File

@ -13,7 +13,7 @@ const (
defCacheAddr = "api-cache:6379"
defCachePassword = "12345678"
defDbURL = "postgres://postgres:12345678@postgres-db:5432/egommerce"
defEventBusURL = "amqp://guest:guest@api-eventbus:56721"
defEventBusURL = "amqp://guest:guest@api-gateway:5672"
defKVNmspc = "dev.egommerce/service/catalog"
defLoggerAddr = "api-logger:24224"
defNetAddr = ":80"

View File

@ -242,6 +242,7 @@ func (w *Worker) processMsg(srvc *service.CatalogService, d amqp.Delivery) {
}
rnr := &CommandRunner{}
name := fmt.Sprintf("%s", msg["event"])
data := (msg["data"]).(map[string]interface{})
// reqID := (data["request_id"]).(string) // FIXME Check input params!
@ -257,16 +258,12 @@ func (w *Worker) processMsg(srvc *service.CatalogService, d amqp.Delivery) {
ok, _ = rnr.run(data)
if ok {
w.Logger.Log("Successful executed message \"%s\"\n", name)
d.Ack(false)
return
}
if !ok {
w.Logger.Log("Error processing \"%s\": %s (%v)", name, err.Error(), err)
d.Reject(false) // FIXME: or Nack(repeat until success - maybe message shout know...?
w.Logger.Log("Error processing \"%s\": %s (%v)", name, err.Error(), err)
d.Reject(false) // FIXME: or Nack(repeat until success - maybe message shout know...?
return
}
w.Logger.Log("Finalized processing: %s", name)
d.Ack(false)
return
}