dapr

package
v0.4.14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

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.

func (*CallbackServer) Start

func (s *CallbackServer) Start(context.Context) error

Start blocks while the Dapr callback gRPC service is serving.

func (*CallbackServer) Stop

func (s *CallbackServer) Stop(ctx context.Context) error

Stop gracefully shuts down the callback service, falling back to an immediate stop if the Kernel shutdown context expires.

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

func Attach(server *grpc.Server) (*Runtime, error)

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

func AttachTransport(server *kgrpc.Server) (*Runtime, error)

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

func AttachTransportWithClient(server *kgrpc.Server, client Client) (*Runtime, error)

AttachTransportWithClient is the explicit-client variant of AttachTransport.

func AttachWithClient

func AttachWithClient(server *grpc.Server, client Client) (*Runtime, error)

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) Delete

func (r *Runtime) Delete(ctx context.Context, name string) error

func (*Runtime) Get

func (r *Runtime) Get(ctx context.Context, name string) (taskx.ManagedJob, error)

func (*Runtime) RegisterHandler

func (r *Runtime) RegisterHandler(name string, handler taskx.EventHandler) error

func (*Runtime) Schedule

func (r *Runtime) Schedule(ctx context.Context, spec taskx.ManagedJob) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL