-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.go
22 lines (20 loc) · 1.28 KB
/
message.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package streams
import "time"
// A Message is the unit of transport containing information generated by a system.
// In addition, it contains metadata used by `streams` internal mechanisms.
// A Message will be/is transported through one or more streams.
type Message struct {
ID string `json:"message_id"` // Message unique identifier.
StreamName string `json:"stream_name"` // Name of the stream this Message will be/is transported.
StreamKey string `json:"stream_key"` // A key used by underlying systems to route a Message to specific partitions/queues.
Headers map[string]string `json:"message_headers"` // Map which passes additional context and metadata about the message.
// Type of Data content.
//
// The usage of the RFC2046 MIME specification is preferred (e.g. application/json, application/xml).
//
// [Reference](https://www.rfc-editor.org/rfc/rfc2046).
ContentType string `json:"content_type"`
Data []byte `json:"data"` // Encoded information generated by a system.
Time time.Time `json:"message_time"` // Timestamp of a Message publishing operation.
DecodedData any `json:"-"` // Only available on readers. Decoded Data using an underlying codec.Codec implementation.
}