message

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const IntuJSONVersion = "1"

IntuJSONVersion is the envelope format version stamped into every serialized IntuMessage. Consumers can use it for forward compatibility.

Variables

This section is empty.

Functions

func ResponseToIntuJSON added in v1.0.4

func ResponseToIntuJSON(resp *Response) ([]byte, error)

ResponseToIntuJSON converts a destination Response into IntuMessage JSON.

Types

type ContentType

type ContentType string
const (
	ContentTypeRaw       ContentType = "raw"
	ContentTypeJSON      ContentType = "json"
	ContentTypeXML       ContentType = "xml"
	ContentTypeCSV       ContentType = "csv"
	ContentTypeHL7v2     ContentType = "hl7v2"
	ContentTypeHL7v3     ContentType = "hl7v3"
	ContentTypeFHIR      ContentType = "fhir_r4"
	ContentTypeX12       ContentType = "x12"
	ContentTypeDICOM     ContentType = "dicom"
	ContentTypeDelimited ContentType = "delimited"
	ContentTypeBinary    ContentType = "binary"
	ContentTypeCCDA      ContentType = "ccda"
)

type DICOMMeta added in v1.0.0

type DICOMMeta struct {
	CallingAE string
	CalledAE  string
}

type DatabaseMeta added in v1.0.0

type DatabaseMeta struct {
	Query  string
	Params map[string]any
}

type FTPMeta added in v1.0.0

type FTPMeta struct {
	Filename  string
	Directory string
}

type FileMeta added in v1.0.0

type FileMeta struct {
	Filename  string
	Directory string
}

type HTTPMeta added in v1.0.0

type HTTPMeta struct {
	Headers     map[string]string
	QueryParams map[string]string
	PathParams  map[string]string
	Method      string
	StatusCode  int
}

type KafkaMeta added in v1.0.0

type KafkaMeta struct {
	Headers   map[string]string
	Topic     string
	Key       string
	Partition int
	Offset    int64
}

type Message

type Message struct {
	ID            string
	CorrelationID string
	ChannelID     string
	Raw           []byte
	Transport     string
	ContentType   ContentType
	SourceCharset string // e.g. "iso-8859-1", "utf-16le"; empty means UTF-8
	HTTP          *HTTPMeta
	File          *FileMeta
	FTP           *FTPMeta
	Kafka         *KafkaMeta
	TCP           *TCPMeta
	SMTP          *SMTPMeta
	DICOM         *DICOMMeta
	Database      *DatabaseMeta
	Metadata      map[string]any
	Timestamp     time.Time
}

func FromIntuJSON added in v1.0.4

func FromIntuJSON(data []byte, channelID string) (*Message, error)

FromIntuJSON reconstructs a Message from IntuMessage JSON stored in content. Identity fields (id, correlationId, channelId, timestamp) are restored when present, making export/import/replay fully round-trippable. Falls back to generating fresh identity when the envelope predates version 1.

func New

func New(channelID string, raw []byte) *Message

func Rebuild added in v1.0.7

func Rebuild(id, correlationID, channelID string, content []byte, ts time.Time) *Message

Rebuild reconstructs a Message from a stored MessageRecord. It uses FromIntuJSON when the content is valid IntuMessage JSON, falling back to treating it as raw bytes. CorrelationID is always restored from the record. This is the canonical reprocess path used by both CLI and dashboard.

func (*Message) ClearTransportMeta added in v1.0.4

func (m *Message) ClearTransportMeta()

ClearTransportMeta resets all transport-specific metadata fields so a destination connector can stamp fresh values without stale source metadata.

func (*Message) CloneWithRaw added in v1.0.4

func (m *Message) CloneWithRaw(raw []byte) *Message

CloneWithRaw returns a shallow copy of the message with Raw replaced.

func (*Message) EnsureHTTP added in v1.0.0

func (m *Message) EnsureHTTP() *HTTPMeta

EnsureHTTP initializes the HTTP meta if nil and returns it.

func (*Message) ToIntuJSON added in v1.0.4

func (m *Message) ToIntuJSON() ([]byte, error)

ToIntuJSON serializes the Message as an IntuMessage JSON envelope. If Raw is valid UTF-8 the body is stored as a string; otherwise it is base64-encoded to avoid data corruption in JSON.

type Response

type Response struct {
	StatusCode int
	Body       []byte
	Headers    map[string]string
	Error      error
}

type SMTPMeta added in v1.0.0

type SMTPMeta struct {
	From    string
	To      []string
	Subject string
	CC      []string
	BCC     []string
}

type TCPMeta added in v1.0.0

type TCPMeta struct {
	RemoteAddr string
}

Jump to

Keyboard shortcuts

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