Documentation
¶
Index ¶
Constants ¶
View Source
const ( // SubscriptionResponseStatusSuccess means message is processed successfully. SubscriptionResponseStatusSuccess = "SUCCESS" // SubscriptionResponseStatusRetry means message to be retried by Dapr. SubscriptionResponseStatusRetry = "RETRY" // SubscriptionResponseStatusDrop means warning is logged and message is dropped. SubscriptionResponseStatusDrop = "DROP" )
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 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 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 Service ¶
type Service interface {
// AddServiceInvocationHandler appends provided service invocation handler with its name to the service.
AddServiceInvocationHandler(name string, fn func(ctx context.Context, in *InvocationEvent) (out *Content, err error)) 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 func(ctx context.Context, e *TopicEvent) (retry bool, err error)) error
// AddBindingInvocationHandler appends provided binding invocation handler with its name to the service.
AddBindingInvocationHandler(name string, fn func(ctx context.Context, in *BindingEvent) (out []byte, err error)) error
// RegisterActorImplFactory Register a new actor to actor runtime of go sdk
RegisterActorImplFactory(f actor.Factory, opts ...config.Option)
// Start starts service.
Start() error
// Stop stops the previously started service.
Stop() error
}
Service represents Dapr callback service.
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"`
// Route is the route of the handler where HTTP topic events should be published (not used in gRPC)
Route string `json:"route"`
// Metadata is the subscription metadata
Metadata map[string]string `json:"metadata,omitempty"`
}
Subscription represents single topic subscription.
type SubscriptionResponse ¶ added in v0.11.1
type SubscriptionResponse struct {
Status string `json:"status"`
}
SubscriptionResponse represents the response handling hint from subscriber to Dapr.
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 base64 encoding content of the event.
// Note, this is processing rawPayload and binary content types .
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"`
}
TopicEvent is the content of the inbound topic message.
Click to show internal directories.
Click to hide internal directories.