Documentation
¶
Index ¶
- func ArgoUnmarshalEvent(dest interface{}, str string) (err error)
- func Close()
- func Connect()
- func SetReconnect(r bool)
- func SetTimeout(t time.Duration)
- func UnmarshalEvent(dest interface{}, str string) (err error)
- type ArgoEvent
- type ArgoEventContext
- type ArgoEventData
- type Client
- type Consumer
- type Message
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgoUnmarshalEvent ¶
func Connect ¶
func Connect()
Connect establishes a connection to the NATS server.
USAGE:
import "api/lib/stream"
stream.New().
InitStream("default").
NewMessage().
SetSubject("notifications.email", params.Kind, params.Category).
SetData(map[string]int{"pending_notifications_id": row.ID}).
Publish()
func SetReconnect ¶
func SetReconnect(r bool)
func SetTimeout ¶
func UnmarshalEvent ¶
Types ¶
type ArgoEvent ¶
type ArgoEvent struct {
Context ArgoEventContext `json:"context"`
Data string `json:"data"`
}
Event represents an event received from an argo event source
func ArgoEventFromString ¶
type ArgoEventContext ¶
type ArgoEventContext struct {
ID string `json:"id"`
Source string `json:"source"`
SpecVersion string `json:"specversion"`
Type string `json:"type"`
DataContentType string `json:"datacontenttype"`
Subject string `json:"subject"`
Time string `json:"time"`
}
EventContext represents the context of an event
type ArgoEventData ¶
type ArgoEventData struct {
Subject string `json:"subject"`
Body interface{} `json:"body"`
}
type Consumer ¶
type Consumer struct {
// contains filtered or unexported fields
}
func NewConsumer ¶
type Message ¶
func (*Message) SetSubject ¶
SetSubject sets the subject of the message. The subject is used to route the message to the correct stream.
even though stream name is not required to relate a message to a stream, it forces our naming convention and makes it easier to find the stream that the message belongs to
Click to show internal directories.
Click to hide internal directories.