Documentation
¶
Index ¶
- func NewStandalone(callbackAddress string) (*Runtime, *CallbackServer, error)
- type CallbackRegistrar
- type CallbackServer
- type Client
- type Runtime
- func Attach(server *grpc.Server) (*Runtime, error)
- func AttachTransport(server *kgrpc.Server) (*Runtime, error)
- func AttachTransportWithClient(server *kgrpc.Server, client Client) (*Runtime, error)
- func AttachWithClient(server *grpc.Server, client Client) (*Runtime, error)
- func New(client Client, callbacks CallbackRegistrar) (*Runtime, error)
- func (r *Runtime) Close()
- func (r *Runtime) Delete(ctx context.Context, name string) error
- func (r *Runtime) Get(ctx context.Context, name string) (taskx.ManagedJob, error)
- func (r *Runtime) RegisterHandler(name string, handler taskx.EventHandler) error
- func (r *Runtime) Schedule(ctx context.Context, spec taskx.ManagedJob) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewStandalone ¶
func NewStandalone(callbackAddress string) (*Runtime, *CallbackServer, error)
NewStandalone creates a Dapr task Runtime and a dedicated gRPC callback server bound to callbackAddress. Register handlers before Kernel starts the returned CallbackServer.
The Dapr sidecar app-port must point to callbackAddress. Calls from this Runtime to the sidecar still use DAPR_GRPC_ENDPOINT or DAPR_GRPC_PORT.
Types ¶
type CallbackRegistrar ¶
type CallbackRegistrar interface {
AddJobEventHandler(string, common.JobEventHandler) error
}
CallbackRegistrar registers handlers on Dapr's AppCallback gRPC service.
type CallbackServer ¶
type CallbackServer struct {
// contains filtered or unexported fields
}
CallbackServer adapts a standalone Dapr gRPC callback service to Kernel's transport.Server lifecycle. It is the recommended production mode when the primary application gRPC server has authn/authz middleware that must not be applied to trusted sidecar callbacks.
type Client ¶
type Client interface {
ScheduleJob(context.Context, *daprclient.Job) error
GetJob(context.Context, string) (*daprclient.Job, error)
DeleteJob(context.Context, string) error
Close()
}
Client is the subset of the Dapr Go client used by taskx. It matches daprclient.GRPCClient exactly so any Dapr Go SDK version that implements these methods satisfies the interface.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime implements taskx.Runtime using the Dapr Jobs gRPC API. The Dapr Scheduler persists definitions in etcd and dispatches due jobs to one sidecar replica for the application ID.
func Attach ¶
Attach registers Dapr's AppCallback and Jobs callback services on an existing gRPC server and creates a sidecar client using DAPR_GRPC_ENDPOINT or DAPR_GRPC_PORT. Kernel remains responsible for starting and stopping server.
func AttachTransport ¶
AttachTransport registers Dapr callbacks on a Kernel transportx/grpc Server. It must be called after the server is constructed and before Start/Serve.
func AttachTransportWithClient ¶
AttachTransportWithClient is the explicit-client variant of AttachTransport.
func AttachWithClient ¶
AttachWithClient is the explicit-client variant of Attach.
func New ¶
func New(client Client, callbacks CallbackRegistrar) (*Runtime, error)
New creates a Dapr runtime from an existing Dapr client and callback registrar. This constructor is useful for tests and advanced boot wiring.
func (*Runtime) Close ¶
func (r *Runtime) Close()
Close releases a client created by Attach. It does not stop the shared Kernel gRPC server and does not shut down the Dapr sidecar.
func (*Runtime) RegisterHandler ¶
func (r *Runtime) RegisterHandler(name string, handler taskx.EventHandler) error