summaryrefslogtreecommitdiff
path: root/service/http
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2019-11-03 18:33:41 +0300
committerWolfy-J <[email protected]>2019-11-03 18:33:41 +0300
commitfbf5e2e677b7c1f89114a29acdd834536316ab73 (patch)
tree9144467b4c0e3982ae23210b569226f65080c16c /service/http
parentb4b1d63e02895e241447b75bbe7f755191c47227 (diff)
- the ability to set custom command producer for roadrunner
- minor improvements in metrics service - List() function for Container to receive names of all available services
Diffstat (limited to 'service/http')
-rw-r--r--service/http/service.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/service/http/service.go b/service/http/service.go
index 58038acb..945a12c4 100644
--- a/service/http/service.go
+++ b/service/http/service.go
@@ -31,6 +31,7 @@ type middleware func(f http.HandlerFunc) http.HandlerFunc
// Service manages rr, http servers.
type Service struct {
cfg *Config
+ cprod roadrunner.CommandProducer
env env.Environment
lsns []func(event int, ctx interface{})
mdwr []middleware
@@ -48,6 +49,11 @@ func (s *Service) Attach(w roadrunner.Controller) {
s.controller = w
}
+// ProduceCommands changes the default command generator method
+func (s *Service) ProduceCommands(producer roadrunner.CommandProducer) {
+ s.cprod = producer
+}
+
// AddMiddleware adds new net/http mdwr.
func (s *Service) AddMiddleware(m middleware) {
s.mdwr = append(s.mdwr, m)
@@ -87,6 +93,7 @@ func (s *Service) Serve() error {
}
}
+ s.cfg.Workers.CommandProducer = s.cprod
s.cfg.Workers.SetEnv("RR_HTTP", "true")
s.rr = roadrunner.NewServer(s.cfg.Workers)