Documentation
¶
Index ¶
Constants ¶
const ( // DefaultCloudEventType is the default event type for an pulse published event DefaultCloudEventType = "com.pulse.event.sent" // CloudEventsSpecVersion is the specversion used by pulse for the cloud events implementation CloudEventsSpecVersion = "1.0" //ContentType is the Cloud Events HTTP content type ContentType = "application/cloudevents+json" // DefaultCloudEventSource is the default event source DefaultCloudEventSource = "pulse" // DefaultCloudEventWebhook DefaultCloudEventWebhook = "" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudEventsEnvelope ¶
type CloudEventsEnvelope struct { ID string `json:"id"` Source string `json:"source"` Type string `json:"type"` SpecVersion string `json:"specversion"` // See DataContentType https://tools.ietf.org/html/rfc2046 DataContentType string `json:"datacontenttype"` Data []byte `json:"data"` Topic string `json:"topic"` WebhookURL string `json:"webhookUrl"` OrderingKey string `json:"orderingKey"` // for test, order id, would be ordered consume by the consumer. // Logic is represents the fields that don't need initialize by the protocol producer. Size int // DeliveryAttempt is the number of times a protocol has been delivered. // This is part of the dead lettering feature that forwards messages that // fail to be processed (from nack/ack deadline timeout) to a dead letter topic. // If dead lettering is enabled, this will be set on all attempts, starting // with value 1. Otherwise, the value will be nil. // This field is read-only. DeliveryAttempt *int DoneFunc func(string, bool) `json:"-"` // contains filtered or unexported fields }
CloudEventsEnvelope describes the Dapr implementation of the Cloud Events spec Spec details: https://github.com/cloudevents/spec/blob/master/spec.md
func NewCloudEventsEnvelope ¶
func NewCloudEventsEnvelope(id, source, datacontentType, eventType, topic, webhook, orderingKey string, data []byte) (*CloudEventsEnvelope, error)
NewCloudEventsEnvelope returns CloudEventsEnvelope from data or a new one when data content was not
func NewSimpleByteMessage ¶
func NewSimpleByteMessage(data []byte) *CloudEventsEnvelope
NewSimpleByteMessage -
func (*CloudEventsEnvelope) Ack ¶
func (m *CloudEventsEnvelope) Ack()
Ack indicates successful processing of a Message passed to the Subscriber.Receive callback. It should not be called on any other Message value. If protocol acknowledgement fails, the Message will be redelivered. Client code must call Ack or Nack when finished for each received Message. Calls to Ack or Nack have no effect after the first call.
func (*CloudEventsEnvelope) Nack ¶
func (m *CloudEventsEnvelope) Nack()
Nack indicates that the client will not or cannot process a Message passed to the Subscriber.Receive callback. It should not be called on any other Message value. Nack will result in the Message being redelivered more quickly than if it were allowed to expire. Client code must call Ack or Nack when finished for each received Message. Calls to Ack or Nack have no effect after the first call.
func (*CloudEventsEnvelope) String ¶
func (m *CloudEventsEnvelope) String() string
hint: now protocol string just print the event
type Message ¶
func NewMessage ¶
type Metadata ¶
func NewMetadata ¶
func NewMetadata() Metadata
func (*Metadata) GetDriverName ¶
if driverName is empty, use default local driver. which couldn't cross process
type PublishRequest ¶
type PublishRequest struct { Data []byte `json:"data"` PubsubName string `json:"pubsubname"` Topic string `json:"topic"` Metadata map[string]string `json:"metadata"` OrderingKey string `json:"orderingkey"` }
PublishRequest is the request to publish a message
type SubscribeRequest ¶
SubscribeRequest is the request to subscribe to a topic
func NewSubscribeRequest ¶
func NewSubscribeRequest(topic string, metadata Metadata) *SubscribeRequest