Documentation
¶
Index ¶
- Constants
- func DecodePayload(payload json.RawMessage, v any) error
- func EncodeEnvelope(env Envelope) ([]byte, error)
- func EncodePayload(payload any) (json.RawMessage, error)
- func NewCorrelationID(prefix string) string
- func NewReplyQueue(queuePrefix, clientPrefix string) string
- type Envelope
- func DecodeEnvelope(data []byte) (Envelope, error)
- func NewEnvelope(msgType string, payload any) (Envelope, error)
- func NewErrorReply(correlationID string, errorMsg string) Envelope
- func NewReply(correlationID string, msgType string, payload any) (Envelope, error)
- func NewRequest(msgType string, payload any, replyTo string) (Envelope, error)
- func ReplyErr(req Envelope, err error) Envelope
- func ReplyOK(req Envelope, payload any) (Envelope, error)
Constants ¶
View Source
const ( StatusOK = "ok" StatusError = "error" )
View Source
const DefaultReplyQueuePrefix = "/queue/reply."
Variables ¶
This section is empty.
Functions ¶
func DecodePayload ¶
func DecodePayload(payload json.RawMessage, v any) error
func EncodeEnvelope ¶
func EncodePayload ¶
func EncodePayload(payload any) (json.RawMessage, error)
func NewCorrelationID ¶
func NewReplyQueue ¶
Types ¶
type Envelope ¶
type Envelope struct {
Type string `json:"type"`
CorrelationID string `json:"correlationId,omitempty"`
ReplyTo string `json:"replyTo,omitempty"`
Status string `json:"status,omitempty"`
Error string `json:"error,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
}
func DecodeEnvelope ¶
func NewErrorReply ¶
Click to show internal directories.
Click to hide internal directories.