blob: ee3414a605ad6bf715ead3ee58ec4fac47de8575 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
package util
import (
"errors"
"github.com/spiral/roadrunner/service"
rrpc "github.com/spiral/roadrunner/service/rpc"
"net/rpc"
)
// RPCClient returns RPC client associated with given roadrunner service container.
func RPCClient(container service.Container) (*rpc.Client, error) {
svc, st := container.Get(rrpc.ID)
if st < service.StatusOK {
return nil, errors.New("RPC service is not configured")
}
return svc.(*rrpc.Service).Client()
}
|