Skip to content
This repository was archived by the owner on Oct 28, 2022. It is now read-only.

Commit

Permalink
enable event processors when using the listen command
Browse files Browse the repository at this point in the history
  • Loading branch information
karimra committed Apr 2, 2022
1 parent 6784999 commit 0d50b89
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion cmd/listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,16 @@ func newListenCmd() *cobra.Command {
}
gApp.Logger.Printf("loaded proto files")
}
// read config
actCfg, err := gApp.Config.GetActions()
if err != nil {
return fmt.Errorf("failed reading actions config: %v", err)
}
procCfg, err := gApp.Config.GetEventProcessors()
if err != nil {
return fmt.Errorf("failed reading event processors config: %v", err)
}

server.Outputs = make(map[string]outputs.Output)
outCfgs, err := gApp.Config.GetOutputs()
if err != nil {
Expand All @@ -80,7 +90,12 @@ func newListenCmd() *cobra.Command {
if outType, ok := outConf["type"]; ok {
if initializer, ok := outputs.Outputs[outType.(string)]; ok {
out := initializer()
go out.Init(ctx, name, outConf, outputs.WithLogger(gApp.Logger))
go out.Init(ctx, name, outConf,
outputs.WithLogger(gApp.Logger),
outputs.WithEventProcessors(procCfg, gApp.Logger, nil, actCfg),
outputs.WithName(gApp.Config.InstanceName),
outputs.WithClusterName(gApp.Config.ClusterName),
)
server.Outputs[name] = out
}
}
Expand Down

0 comments on commit 0d50b89

Please sign in to comment.