dapr

package
v1.0.37 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2023 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ContentTypeJson = "application/json"

Variables

This section is empty.

Functions

func DeleteState

func DeleteState(storeName, key string) error

DeleteState 删除状态

func Error

func Error(err error) (*common.Content, error)

func GetInvocationHandlers

func GetInvocationHandlers(registry map[string]*ServiceModule) map[string]common.ServiceInvocationHandler

GetInvocationHandlers 从注册中心获取Dapr InvocationHandler

func GetMetaValue

func GetMetaValue(ctx context.Context, key string) string

GetMetaValue get the first grpc meta value

func GetMetaValues

func GetMetaValues(ctx context.Context, key string) []string

GetMetaValues get grpc meta values

func GetState

func GetState(storeName, key string) ([]byte, error)

GetState 保存状态

func Invoke

func Invoke(appId string, version int, namespace, method string, data interface{}, args ...string) ([]byte, error)

Invoke 调用dapr服务

func InvokeWithClient

func InvokeWithClient(appId string, version int, namespace, client, method string, data interface{}, args ...string) ([]byte, error)

InvokeWithClient 调用dapr服务

func Lock

func Lock(lockStore, lockOwner, resource string, expiryInSeconds int) error

Lock 锁

func Publish

func Publish(pubSubName, topic string, data interface{}, args ...bool) error

Publish 发布消息 isRawPayLoad 发送原始的消息,非cloudevent message

func RegisterHandlers

func RegisterHandlers(app string, module interface{}, methods map[string]common.ServiceInvocationHandler, registry map[string]*ServiceModule) error

RegisterHandlers register handlers to global registry

func SaveState

func SaveState(storeName, key string, value interface{}) error

SaveState 保存状态

func Success

func Success(event *common.InvocationEvent, resp interface{}) (*common.Content, error)

func Unlock

func Unlock(lockStore, lockOwner, resource string) error

Unlock 取消锁

Types

type Event

type Event struct {
	Subscription *common.Subscription
	Handler      common.TopicEventHandler
}

func GetEvent

func GetEvent(pubsubName, topic string, handler common.TopicEventHandler, args ...bool) Event

type ServiceModule

type ServiceModule struct {
	// contains filtered or unexported fields
}

func (*ServiceModule) GetAnnotations

func (sm *ServiceModule) GetAnnotations(args ...string) ([]*serviceModuleHandlerAnnotation, error)

GetAnnotations 解析服务模块中的所有注解和注释 handlerName=>*serviceModuleHandlerAnnotation

func (*ServiceModule) GetRoutes

func (sm *ServiceModule) GetRoutes(args ...string) ([]*ServiceModuleRoute, error)

GetRoutes 获取路由

type ServiceModuleRoute

type ServiceModuleRoute struct {
	App           string   // app name
	Handler       string   // dapr method
	Namespace     string   // namespace
	Client        string   // 客户端
	Version       int      // version
	Endpoint      string   // endpoint
	Methods       []string // http methods
	CallerId      int64    // 第三方回调应用id
	IsRawResponse bool     // 是否返回原始消息
	IsPublic      bool     // 是否是公共方法
	Comments      []string // 备注
}

Jump to

Keyboard shortcuts

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