wire

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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 EncodeEnvelope(env Envelope) ([]byte, error)

func EncodePayload

func EncodePayload(payload any) (json.RawMessage, error)

func NewCorrelationID

func NewCorrelationID(prefix string) string

func NewReplyQueue

func NewReplyQueue(queuePrefix, clientPrefix string) string

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 DecodeEnvelope(data []byte) (Envelope, error)

func NewEnvelope

func NewEnvelope(msgType string, payload any) (Envelope, error)

func NewErrorReply

func NewErrorReply(correlationID string, errorMsg string) Envelope

func NewReply

func NewReply(correlationID string, msgType string, payload any) (Envelope, error)

func NewRequest

func NewRequest(msgType string, payload any, replyTo string) (Envelope, error)

func ReplyErr

func ReplyErr(req Envelope, err error) Envelope

func ReplyOK

func ReplyOK(req Envelope, payload any) (Envelope, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL