Documentation
¶
Index ¶
- func Report(reporters []metrics.Reporter, period time.Duration)
- type EnqueueOpts
- 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 logger.Logger)
- func (w *Worker) Start()
- func (w *Worker) Started() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type EnqueueOpts ¶
type EnqueueOpts struct {
RetryEnabled bool
MaxRetries int
ExponentialFactor int
MinDelayToRetry int
MaxDelayToRetry int
MaxRandom int
}
EnqueueOpts has retry options for worker
func NewEnqueueOpts ¶
func NewEnqueueOpts(config *config.Config) *EnqueueOpts
NewEnqueueOpts reads from config to build *EnqueueOpts
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 (*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 *EnqueueOpts, ) (jid string, err error)
EnqueueRPCWithOptions enqueues rpc job to worker
func (*Worker) RegisterRPCJob ¶
RegisterRPCJob registers a RPC job
Source Files
¶
Click to show internal directories.
Click to hide internal directories.