Update Oclib for event generation

This commit is contained in:
mr
2026-02-02 14:30:01 +01:00
parent 2be337a121
commit 3059e7fcbc
5 changed files with 71 additions and 69 deletions

View File

@@ -106,19 +106,19 @@ func (template *Template) CreateEventContainer(exec *workflow_execution.Workflow
container := Container{Image: "natsio/nats-box"}
container.Command = []string{"sh", "-c"} // all is bash
var event *native_tools.WorkflowEventParams
var event native_tools.WorkflowEventParams
b, err := json.Marshal(nt.Params)
if err != nil {
fmt.Println(err)
return
}
err = json.Unmarshal(b, event)
err = json.Unmarshal(b, &event)
if err != nil {
fmt.Println(err)
return
}
if event != nil {
container.Args = append(container.Args, "nats pub --server "+conf.GetConfig().NatsURL+":4222 "+tools.WORKFLOW_EVENT.GenerateKey(tools.WORKFLOW_EVENT.String())+" '{\"workflow_id\":\""+event.WorkflowResourceID+"\"}'")
if event.WorkflowResourceID != "" {
container.Args = append(container.Args, "nats pub --server "+conf.GetConfig().NatsURL+":4222 "+tools.WORKFLOW_EVENT.GenerateKey()+" '{\"workflow_id\":\""+event.WorkflowResourceID+"\"}'")
container.Args = []string{strings.Join(container.Args, " ")}
template.Container = container
}