1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
package beanstalk
import (
"github.com/spiral/roadrunner/v2/common/jobs"
"github.com/spiral/roadrunner/v2/pkg/events"
priorityqueue "github.com/spiral/roadrunner/v2/pkg/priority_queue"
"github.com/spiral/roadrunner/v2/plugins/config"
"github.com/spiral/roadrunner/v2/plugins/jobs/pipeline"
"github.com/spiral/roadrunner/v2/plugins/logger"
)
const (
pluginName string = "beanstalk"
)
type Plugin struct {
log logger.Logger
cfg config.Configurer
}
func (p *Plugin) Init(log logger.Logger, cfg config.Configurer) error {
p.log = log
p.cfg = cfg
return nil
}
func (p *Plugin) Serve() chan error {
return make(chan error)
}
func (p *Plugin) Stop() error {
return nil
}
func (p *Plugin) Name() string {
return pluginName
}
func (p *Plugin) Available() {}
func (p *Plugin) JobsConstruct(configKey string, eh events.Handler, pq priorityqueue.Queue) (jobs.Consumer, error) {
return NewBeanstalkConsumer(configKey, p.log, p.cfg, eh, pq)
}
func (p *Plugin) FromPipeline(pipe *pipeline.Pipeline, eh events.Handler, pq priorityqueue.Queue) (jobs.Consumer, error) {
return FromPipeline(pipe, p.log, p.cfg, eh, pq)
}
|