diff options
author | Valery Piashchynski <[email protected]> | 2021-06-22 15:20:08 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-22 15:20:08 +0300 |
commit | 5627146e45afbb8f6566862c60a42a0b0aad2d0a (patch) | |
tree | 731e4157c3c09dabab60bd2c78910facf23fce75 /plugins/jobs/plugin.go | |
parent | 1a2a1f4735e40675abf6cd9767c99374359ec2bb (diff) |
- Move common interfaces and structures to the 'common' folder
- Update tests
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'plugins/jobs/plugin.go')
-rw-r--r-- | plugins/jobs/plugin.go | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/jobs/plugin.go b/plugins/jobs/plugin.go index cda2a711..bd5ff5bf 100644 --- a/plugins/jobs/plugin.go +++ b/plugins/jobs/plugin.go @@ -2,6 +2,7 @@ package jobs import ( "context" + "fmt" endure "github.com/spiral/endure/pkg/container" "github.com/spiral/errors" @@ -12,6 +13,8 @@ import ( ) const ( + // RrJobs env variable + RrJobs string = "rr_jobs" PluginName string = "jobs" ) @@ -24,6 +27,10 @@ type Plugin struct { consumers map[string]Consumer } +func testListener(data interface{}) { + fmt.Println(data) +} + func (p *Plugin) Init(cfg config.Configurer, log logger.Logger, server server.Server) error { const op = errors.Op("jobs_plugin_init") if !cfg.Has(PluginName) { @@ -35,7 +42,7 @@ func (p *Plugin) Init(cfg config.Configurer, log logger.Logger, server server.Se return errors.E(op, err) } - p.workersPool, err = server.NewWorkerPool(context.Background(), p.cfg.poolCfg, nil, nil) + p.workersPool, err = server.NewWorkerPool(context.Background(), p.cfg.poolCfg, map[string]string{RrJobs: "true"}, testListener) if err != nil { return errors.E(op, err) } |