mirror of
https://github.com/SecurityBrewery/catalyst.git
synced 2025-12-11 01:32:46 +01:00
14
bus/job.go
14
bus/job.go
@@ -6,24 +6,24 @@ import (
|
||||
|
||||
emitter "github.com/emitter-io/go/v2"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/model"
|
||||
)
|
||||
|
||||
const channelJob = "job"
|
||||
|
||||
type JobMsg struct {
|
||||
ID string `json:"id"`
|
||||
Automation string `json:"automation"`
|
||||
Origin *models.Origin `json:"origin"`
|
||||
Message *models.Message `json:"message"`
|
||||
ID string `json:"id"`
|
||||
Automation string `json:"automation"`
|
||||
Origin *model.Origin `json:"origin"`
|
||||
Message *model.Message `json:"message"`
|
||||
}
|
||||
|
||||
func (b *Bus) PublishJob(id, automation string, payload interface{}, context *models.Context, origin *models.Origin) error {
|
||||
func (b *Bus) PublishJob(id, automation string, payload interface{}, context *model.Context, origin *model.Origin) error {
|
||||
return b.jsonPublish(&JobMsg{
|
||||
ID: id,
|
||||
Automation: automation,
|
||||
Origin: origin,
|
||||
Message: &models.Message{
|
||||
Message: &model.Message{
|
||||
Context: context,
|
||||
Payload: payload,
|
||||
},
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
|
||||
emitter "github.com/emitter-io/go/v2"
|
||||
|
||||
"github.com/SecurityBrewery/catalyst/generated/models"
|
||||
"github.com/SecurityBrewery/catalyst/generated/model"
|
||||
)
|
||||
|
||||
const channelResult = "result"
|
||||
@@ -14,10 +14,10 @@ const channelResult = "result"
|
||||
type ResultMsg struct {
|
||||
Automation string `json:"automation"`
|
||||
Data map[string]interface{} `json:"data,omitempty"`
|
||||
Target *models.Origin `json:"target"`
|
||||
Target *model.Origin `json:"target"`
|
||||
}
|
||||
|
||||
func (b *Bus) PublishResult(automation string, data map[string]interface{}, target *models.Origin) error {
|
||||
func (b *Bus) PublishResult(automation string, data map[string]interface{}, target *model.Origin) error {
|
||||
return b.jsonPublish(&ResultMsg{Automation: automation, Data: data, Target: target}, channelResult, b.config.resultBusKey)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user