Documentation ¶
Index ¶
- func Report(reporters []metrics.Reporter, period time.Duration)
- type RPCJob
- type Worker
- func (w *Worker) EnqueueRPC(routeStr string, metadata map[string]interface{}, reply, arg proto.Message) (jid string, err error)
- func (w *Worker) EnqueueRPCWithOptions(routeStr string, metadata map[string]interface{}, reply, arg proto.Message, ...) (jid string, err error)
- func (w *Worker) RegisterRPCJob(rpcJob RPCJob) error
- func (w *Worker) SetLogger(logger interfaces.Logger)
- func (w *Worker) Start()
- func (w *Worker) Started() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RPCJob ¶
type RPCJob interface { // ServerDiscovery returns a serverID based on the route // and any metadata that is necessary to decide ServerDiscovery( route string, rpcMetadata map[string]interface{}, ) (serverID string, err error) // RPC executes the RPC // It is expected that if serverID is "" the RPC // happens to any destiny server RPC( ctx context.Context, serverID, routeStr string, reply, arg proto.Message, ) error // GetArgReply returns the arg and reply of the // method GetArgReply(route string) (arg, reply proto.Message, err error) }
RPCJob has infos to execute a rpc on worker
type Worker ¶
type Worker struct {
// contains filtered or unexported fields
}
Worker executes RPCs with retry and backoff time
func NewWorker ¶
func NewWorker(config config.WorkerConfig, opts config.EnqueueOpts) (*Worker, error)
NewWorker configures and returns a *Worker
func (*Worker) EnqueueRPC ¶
func (w *Worker) EnqueueRPC( routeStr string, metadata map[string]interface{}, reply, arg proto.Message, ) (jid string, err error)
EnqueueRPC enqueues rpc job to worker
func (*Worker) EnqueueRPCWithOptions ¶
func (w *Worker) EnqueueRPCWithOptions( routeStr string, metadata map[string]interface{}, reply, arg proto.Message, opts *config.EnqueueOpts, ) (jid string, err error)
EnqueueRPCWithOptions enqueues rpc job to worker
func (*Worker) RegisterRPCJob ¶
RegisterRPCJob registers a RPC job
func (*Worker) SetLogger ¶
func (w *Worker) SetLogger(logger interfaces.Logger)
SetLogger overwrites worker logger
Click to show internal directories.
Click to hide internal directories.