diff --git a/component.go b/component.go index 1c0bbae..8c616db 100644 --- a/component.go +++ b/component.go @@ -13,6 +13,7 @@ import ( type Component struct { ID string `json:"_component_id"` + Subject string `json:"_subject"` Type string `json:"_component"` State string `json:"_state"` Action string `json:"_action"` @@ -24,6 +25,9 @@ type Component struct { func processComponent(msg *nats.Msg) { var c Component + + c.Subject = msg.Subject + if err := json.Unmarshal(msg.Data, &c); err != nil { panic(err) } diff --git a/service.go b/service.go index d322f30..510c22c 100644 --- a/service.go +++ b/service.go @@ -16,11 +16,15 @@ import ( type Service struct { ID string `json:"id"` + Subject string `json:"_subject"` Changes []Component `json:"changes"` } func processService(msg *nats.Msg) { var s Service + + s.Subject = msg.Subject + if err := json.Unmarshal(msg.Data, &s); err != nil { panic(err) } @@ -41,6 +45,7 @@ func processService(msg *nats.Msg) { case "service.create.done", "service.create.error", "service.delete.done", "service.delete.error", "service.import.done", "service.import.error": publishEvent(id, data) // publishEvent(id, cliHangup) + time.Sleep(10 * time.Millisecond) // Remove stream when the build completes log.Println("Closing stream: ", id)