Documentation ¶
Index ¶
- Constants
- type BindingEvent
- type BindingInvocationHandler
- type Content
- type HealthCheckHandler
- type InvocationEvent
- type Job
- type JobEvent
- type JobEventHandler
- type Service
- type ServiceInvocationHandler
- type Subscription
- type SubscriptionResponse
- type SubscriptionResponseStatus
- type TopicEvent
- type TopicEventHandler
Constants ¶
View Source
const ( // AppAPITokenEnvVar is the environment variable for app api token. AppAPITokenEnvVar = "APP_API_TOKEN" /* #nosec */ APITokenKey = "dapr-api-token" /* #nosec */ )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BindingEvent ¶
type BindingEvent struct { // Data is the input bindings sent Data []byte `json:"data"` // Metadata is the input binding metadata Metadata map[string]string `json:"metadata,omitempty"` }
BindingEvent represents the binding event handler input.
type BindingInvocationHandler ¶ added in v1.3.1
type BindingInvocationHandler func(ctx context.Context, in *BindingEvent) (out []byte, err error)
type Content ¶
type Content struct { // Data is the payload that the input bindings sent. Data []byte `json:"data"` // ContentType of the Data ContentType string `json:"contentType"` // DataTypeURL is the resource URL that uniquely identifies the type of the serialized DataTypeURL string `json:"typeUrl,omitempty"` }
Content is a generic data content.
type HealthCheckHandler ¶ added in v1.6.0
type InvocationEvent ¶
type InvocationEvent struct { // Data is the payload that the input bindings sent. Data []byte `json:"data"` // ContentType of the Data ContentType string `json:"contentType"` // DataTypeURL is the resource URL that uniquely identifies the type of the serialized DataTypeURL string `json:"typeUrl,omitempty"` // Verb is the HTTP verb that was used to invoke this service. Verb string `json:"-"` // QueryString represents an encoded HTTP url query string in the following format: name=value&name2=value2 QueryString string `json:"-"` }
InvocationEvent represents the input and output of binding invocation.
type JobEventHandler ¶ added in v1.11.0
type Service ¶
type Service interface { // AddHealthCheckHandler sets a health check handler, name: http (router) and grpc (invalid). AddHealthCheckHandler(name string, fn HealthCheckHandler) error // AddServiceInvocationHandler appends provided service invocation handler with its name to the service. AddServiceInvocationHandler(name string, fn ServiceInvocationHandler) error // AddTopicEventHandler appends provided event handler with its topic and optional metadata to the service. // Note, retries are only considered when there is an error. Lack of error is considered as a success AddTopicEventHandler(sub *Subscription, fn TopicEventHandler) error // AddBindingInvocationHandler appends provided binding invocation handler with its name to the service. AddBindingInvocationHandler(name string, fn BindingInvocationHandler) error // RegisterActorImplFactory Register a new actor to actor runtime of go sdk // Deprecated: use RegisterActorImplFactoryContext instead RegisterActorImplFactory(f actor.Factory, opts ...config.Option) // RegisterActorImplFactoryContext Register a new actor to actor runtime of go sdk RegisterActorImplFactoryContext(f actor.FactoryContext, opts ...config.Option) // AddJobEventHandler appends a provided job event handler with its name to // the service. AddJobEventHandler(name string, fn JobEventHandler) error // Start starts service. Start() error // Stop stops the previously started service. Stop() error // Gracefully stops the previous started service GracefulStop() error }
Service represents Dapr callback service.
type ServiceInvocationHandler ¶ added in v1.3.1
type ServiceInvocationHandler func(ctx context.Context, in *InvocationEvent) (out *Content, err error)
type Subscription ¶
type Subscription struct { // PubsubName is name of the pub/sub this message came from PubsubName string `json:"pubsubname"` // Topic is the name of the topic Topic string `json:"topic"` // Metadata is the subscription metadata Metadata map[string]string `json:"metadata,omitempty"` // Route is the route of the handler where HTTP topic events should be published (passed as Path in gRPC) Route string `json:"route"` // Match is the CEL expression to match on the CloudEvent envelope. Match string `json:"match"` // Priority is the priority in which to evaluate the match (lower to higher). Priority int `json:"priority"` // DisableTopicValidation allows to receive events from publisher topics that differ from the subscribed topic. DisableTopicValidation bool `json:"disableTopicValidation"` }
Subscription represents single topic subscription.
type SubscriptionResponse ¶ added in v0.11.1
type SubscriptionResponse struct {
Status SubscriptionResponseStatus `json:"status"`
}
SubscriptionResponse represents the response handling hint from subscriber to Dapr.
type SubscriptionResponseStatus ¶ added in v1.11.0
type SubscriptionResponseStatus string
const ( // SubscriptionResponseStatusSuccess means message is processed successfully. SubscriptionResponseStatusSuccess SubscriptionResponseStatus = "SUCCESS" // SubscriptionResponseStatusRetry means message to be retried by Dapr. SubscriptionResponseStatusRetry SubscriptionResponseStatus = "RETRY" // SubscriptionResponseStatusDrop means warning is logged and message is dropped. SubscriptionResponseStatusDrop SubscriptionResponseStatus = "DROP" )
type TopicEvent ¶
type TopicEvent struct { // ID identifies the event. ID string `json:"id"` // The version of the CloudEvents specification. SpecVersion string `json:"specversion"` // The type of event related to the originating occurrence. Type string `json:"type"` // Source identifies the context in which an event happened. Source string `json:"source"` // The content type of data value. DataContentType string `json:"datacontenttype"` // The content of the event. // Note, this is why the gRPC and HTTP implementations need separate structs for cloud events. Data interface{} `json:"data"` // The content of the event represented as raw bytes. // This can be deserialized into a Go struct using `Struct`. RawData []byte `json:"-"` // The base64 encoding content of the event. // Note, this is processing rawPayload and binary content types. // This field is deprecated and will be removed in the future. DataBase64 string `json:"data_base64,omitempty"` // Cloud event subject Subject string `json:"subject"` // The pubsub topic which publisher sent to. Topic string `json:"topic"` // PubsubName is name of the pub/sub this message came from PubsubName string `json:"pubsubname"` // Metadata is the custom metadata attached to the event. Metadata map[string]string `json:"metadata,omitempty"` }
TopicEvent is the content of the inbound topic message.
func (*TopicEvent) Struct ¶ added in v1.3.1
func (e *TopicEvent) Struct(target interface{}) error
type TopicEventHandler ¶ added in v1.3.1
type TopicEventHandler func(ctx context.Context, e *TopicEvent) (retry bool, err error)
Click to show internal directories.
Click to hide internal directories.