Documentation
¶
Overview ¶
Example ¶
package main
import (
"fmt"
"reflect"
)
const receivedEvent = `
{
"type": "io.nats.jetstream.advisory.v1.api_audit",
"id": "uafvZ1UEDIW5FZV6kvLgWA",
"timestamp": "2020-04-23T16:51:18.516363Z",
"server": "NDJWE4SOUJOJT2TY5Y2YQEOAHGAK5VIGXTGKWJSFHVCII4ITI3LBHBUV",
"client": {
"host": "::1",
"port": 57924,
"id": 17,
"acc": "$G",
"name": "NATS CLI",
"lang": "go",
"version": "1.9.2"
},
"subject": "$JS.STREAM.LIST",
"response": "[\n \"ORDERS\"\n]"
}
`
func main() {
// sets a location for the schemas repo
SchemasRepo = "https://nats.io/schemas"
// receivedEvent was received over a transport like NATS, webhook or other medium
stype, err := SchemaTypeForMessage([]byte(receivedEvent))
if err != nil {
panic(err.Error())
}
fmt.Printf("Event Type: %s\n", stype)
// parses the received event and extracts the type, determines the url to fetch a schema
address, uri, err := SchemaURL([]byte(receivedEvent))
if err != nil {
panic(err.Error())
}
fmt.Printf("Event Schema URL: %s (%s)\n", address, uri.Host)
// determines the url to fetch for a specific schema kind
address, uri, err = SchemaURLForType("io.nats.jetstream.advisory.v1.api_audit")
if err != nil {
panic(err.Error())
}
fmt.Printf("Type Schema URL: %s (%s)\n", address, uri.Host)
// parses an event into it a type if supported else map[string]any
schema, event, err := ParseMessage([]byte(receivedEvent))
if err != nil {
panic(err.Error())
}
fmt.Printf("Parsed event with type %q into %s\n", schema, reflect.TypeOf(event))
}
Output: Event Type: io.nats.jetstream.advisory.v1.api_audit Event Schema URL: https://nats.io/schemas/jetstream/advisory/v1/api_audit.json (nats.io) Type Schema URL: https://nats.io/schemas/jetstream/advisory/v1/api_audit.json (nats.io) Parsed event with type "io.nats.jetstream.advisory.v1.api_audit" into *advisory.JetStreamAPIAuditV1
Index ¶
- Constants
- Variables
- func IsNatsErr(err error, ids ...uint16) bool
- func IsNatsError(err error, code uint16) bool
- func IsNatsSchemaType(schemaType string) bool
- func NewMessage(schemaType string) (any, bool)
- func ParseAndValidateMessage(m []byte, validator StructValidator) (schemaType string, msg any, err error)
- func ParseMessage(m []byte) (schemaType string, msg any, err error)
- func RenderEvent(wr io.Writer, e Event, format RenderFormat) error
- func RequiredApiLevel(req any) (int, error)
- func Schema(schemaType string) (schema []byte, err error)
- func SchemaFileForType(schemaType string) (path string, err error)
- func SchemaSearch(f string) ([]string, error)
- func SchemaTypeForMessage(e []byte) (schemaType string, err error)
- func SchemaURL(m []byte) (address string, url *url.URL, err error)
- func SchemaURLForType(schemaType string) (address string, url *url.URL, err error)
- func ToCloudEventV1(e Event) ([]byte, error)
- func TypeForJetStreamRequestSubjectPrefix(p string) (any, error)
- func TypeForJetStreamResponseSubjectPrefix(p string) (any, error)
- func TypeForRequestSubject(subject string) (any, error)
- func TypesForJetStreamSubjectPrefix(p string) (request any, response any, err error)
- type AckPolicy
- type ApiError
- type ApiLevelAware
- type ClusterInfo
- type Compression
- type ConsumerAction
- type ConsumerConfig
- type ConsumerInfo
- type ConsumerNakOptions
- type DeliverPolicy
- type DiscardPolicy
- type Event
- type ExternalStream
- type JSApiAccountInfoResponse
- type JSApiAccountPurgeResponse
- type JSApiConsumerCreateRequest
- func (t JSApiConsumerCreateRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerCreateRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerCreateRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerCreateRequest) Schema() ([]byte, error)
- func (t JSApiConsumerCreateRequest) SchemaID() string
- func (t JSApiConsumerCreateRequest) SchemaType() string
- func (t JSApiConsumerCreateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerCreateResponse
- type JSApiConsumerDeleteResponse
- type JSApiConsumerGetNextRequest
- func (t JSApiConsumerGetNextRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerGetNextRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerGetNextRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerGetNextRequest) Schema() ([]byte, error)
- func (t JSApiConsumerGetNextRequest) SchemaID() string
- func (t JSApiConsumerGetNextRequest) SchemaType() string
- func (t JSApiConsumerGetNextRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerInfoResponse
- type JSApiConsumerLeaderStepDownResponse
- func (t JSApiConsumerLeaderStepDownResponse) Schema() ([]byte, error)
- func (t JSApiConsumerLeaderStepDownResponse) SchemaID() string
- func (t JSApiConsumerLeaderStepDownResponse) SchemaType() string
- func (t JSApiConsumerLeaderStepDownResponse) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerLeaderStepdownRequest
- func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerLeaderStepdownRequest) Schema() ([]byte, error)
- func (t JSApiConsumerLeaderStepdownRequest) SchemaID() string
- func (t JSApiConsumerLeaderStepdownRequest) SchemaType() string
- func (t JSApiConsumerLeaderStepdownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerListRequest
- func (t JSApiConsumerListRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerListRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerListRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerListRequest) Schema() ([]byte, error)
- func (t JSApiConsumerListRequest) SchemaID() string
- func (t JSApiConsumerListRequest) SchemaType() string
- func (t JSApiConsumerListRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerListResponse
- type JSApiConsumerNamesRequest
- func (t JSApiConsumerNamesRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerNamesRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerNamesRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerNamesRequest) Schema() ([]byte, error)
- func (t JSApiConsumerNamesRequest) SchemaID() string
- func (t JSApiConsumerNamesRequest) SchemaType() string
- func (t JSApiConsumerNamesRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerNamesResponse
- type JSApiConsumerPauseRequest
- func (t JSApiConsumerPauseRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerPauseRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerPauseRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerPauseRequest) Schema() ([]byte, error)
- func (t JSApiConsumerPauseRequest) SchemaID() string
- func (t JSApiConsumerPauseRequest) SchemaType() string
- func (t JSApiConsumerPauseRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerPauseResponse
- type JSApiConsumerUnpinRequest
- func (t JSApiConsumerUnpinRequest) ApiSubjectFormat() (string, error)
- func (t JSApiConsumerUnpinRequest) ApiSubjectPattern() (string, error)
- func (t JSApiConsumerUnpinRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiConsumerUnpinRequest) Schema() ([]byte, error)
- func (t JSApiConsumerUnpinRequest) SchemaID() string
- func (t JSApiConsumerUnpinRequest) SchemaType() string
- func (t JSApiConsumerUnpinRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiConsumerUnpinResponse
- type JSApiIterableRequest
- type JSApiIterableResponse
- type JSApiLeaderStepDownRequest
- func (t JSApiLeaderStepDownRequest) ApiSubjectFormat() (string, error)
- func (t JSApiLeaderStepDownRequest) ApiSubjectPattern() (string, error)
- func (t JSApiLeaderStepDownRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiLeaderStepDownRequest) Schema() ([]byte, error)
- func (t JSApiLeaderStepDownRequest) SchemaID() string
- func (t JSApiLeaderStepDownRequest) SchemaType() string
- func (t JSApiLeaderStepDownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiLeaderStepDownResponse
- type JSApiMetaServerRemoveRequest
- func (t JSApiMetaServerRemoveRequest) ApiSubjectFormat() (string, error)
- func (t JSApiMetaServerRemoveRequest) ApiSubjectPattern() (string, error)
- func (t JSApiMetaServerRemoveRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiMetaServerRemoveRequest) Schema() ([]byte, error)
- func (t JSApiMetaServerRemoveRequest) SchemaID() string
- func (t JSApiMetaServerRemoveRequest) SchemaType() string
- func (t JSApiMetaServerRemoveRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiMetaServerRemoveResponse
- type JSApiMsgDeleteRequest
- func (t JSApiMsgDeleteRequest) ApiSubjectFormat() (string, error)
- func (t JSApiMsgDeleteRequest) ApiSubjectPattern() (string, error)
- func (t JSApiMsgDeleteRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiMsgDeleteRequest) Schema() ([]byte, error)
- func (t JSApiMsgDeleteRequest) SchemaID() string
- func (t JSApiMsgDeleteRequest) SchemaType() string
- func (t JSApiMsgDeleteRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiMsgDeleteResponse
- type JSApiMsgGetRequest
- func (t JSApiMsgGetRequest) ApiSubjectFormat() (string, error)
- func (t JSApiMsgGetRequest) ApiSubjectPattern() (string, error)
- func (t JSApiMsgGetRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiMsgGetRequest) Schema() ([]byte, error)
- func (t JSApiMsgGetRequest) SchemaID() string
- func (t JSApiMsgGetRequest) SchemaType() string
- func (t JSApiMsgGetRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiMsgGetResponse
- type JSApiResponse
- type JSApiStreamCreateRequest
- func (t JSApiStreamCreateRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamCreateRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamCreateRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamCreateRequest) Schema() ([]byte, error)
- func (t JSApiStreamCreateRequest) SchemaID() string
- func (t JSApiStreamCreateRequest) SchemaType() string
- func (t JSApiStreamCreateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamCreateResponse
- type JSApiStreamDeleteResponse
- type JSApiStreamInfoRequest
- func (t JSApiStreamInfoRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamInfoRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamInfoRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamInfoRequest) Schema() ([]byte, error)
- func (t JSApiStreamInfoRequest) SchemaID() string
- func (t JSApiStreamInfoRequest) SchemaType() string
- func (t JSApiStreamInfoRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamInfoResponse
- type JSApiStreamLeaderStepDownRequest
- func (t JSApiStreamLeaderStepDownRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamLeaderStepDownRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamLeaderStepDownRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamLeaderStepDownRequest) Schema() ([]byte, error)
- func (t JSApiStreamLeaderStepDownRequest) SchemaID() string
- func (t JSApiStreamLeaderStepDownRequest) SchemaType() string
- func (t JSApiStreamLeaderStepDownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamLeaderStepDownResponse
- type JSApiStreamListRequest
- func (t JSApiStreamListRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamListRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamListRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamListRequest) Schema() ([]byte, error)
- func (t JSApiStreamListRequest) SchemaID() string
- func (t JSApiStreamListRequest) SchemaType() string
- func (t JSApiStreamListRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamListResponse
- type JSApiStreamNamesRequest
- func (t JSApiStreamNamesRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamNamesRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamNamesRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamNamesRequest) Schema() ([]byte, error)
- func (t JSApiStreamNamesRequest) SchemaID() string
- func (t JSApiStreamNamesRequest) SchemaType() string
- func (t JSApiStreamNamesRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamNamesResponse
- type JSApiStreamPurgeRequest
- func (t JSApiStreamPurgeRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamPurgeRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamPurgeRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamPurgeRequest) Schema() ([]byte, error)
- func (t JSApiStreamPurgeRequest) SchemaID() string
- func (t JSApiStreamPurgeRequest) SchemaType() string
- func (t JSApiStreamPurgeRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamPurgeResponse
- type JSApiStreamRemovePeerRequest
- func (t JSApiStreamRemovePeerRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamRemovePeerRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamRemovePeerRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamRemovePeerRequest) Schema() ([]byte, error)
- func (t JSApiStreamRemovePeerRequest) SchemaID() string
- func (t JSApiStreamRemovePeerRequest) SchemaType() string
- func (t JSApiStreamRemovePeerRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamRemovePeerResponse
- type JSApiStreamRestoreRequest
- func (t JSApiStreamRestoreRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamRestoreRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamRestoreRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamRestoreRequest) Schema() ([]byte, error)
- func (t JSApiStreamRestoreRequest) SchemaID() string
- func (t JSApiStreamRestoreRequest) SchemaType() string
- func (t JSApiStreamRestoreRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamRestoreResponse
- type JSApiStreamSnapshotRequest
- func (t JSApiStreamSnapshotRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamSnapshotRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamSnapshotRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamSnapshotRequest) Schema() ([]byte, error)
- func (t JSApiStreamSnapshotRequest) SchemaID() string
- func (t JSApiStreamSnapshotRequest) SchemaType() string
- func (t JSApiStreamSnapshotRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamSnapshotResponse
- type JSApiStreamUpdateRequest
- func (t JSApiStreamUpdateRequest) ApiSubjectFormat() (string, error)
- func (t JSApiStreamUpdateRequest) ApiSubjectPattern() (string, error)
- func (t JSApiStreamUpdateRequest) ApiSubjectPrefix() (string, error)
- func (t JSApiStreamUpdateRequest) Schema() ([]byte, error)
- func (t JSApiStreamUpdateRequest) SchemaID() string
- func (t JSApiStreamUpdateRequest) SchemaType() string
- func (t JSApiStreamUpdateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
- type JSApiStreamUpdateResponse
- type JSPubAckResponse
- type JetStreamAPIStats
- type JetStreamAccountLimits
- type JetStreamAccountStats
- type JetStreamTier
- type Level
- type Logger
- type LostStreamData
- type PeerInfo
- type PersistModeType
- type Placement
- type PriorityGroupState
- type PriorityPolicy
- type PubAck
- type RePublish
- type RenderFormat
- type ReplayPolicy
- type RetentionPolicy
- type SchemaManagedApiRequestType
- type SchemaManagedType
- type SequenceInfo
- type StorageType
- type StoredMsg
- type StreamAlternate
- type StreamConfig
- type StreamConsumerLimits
- type StreamInfo
- type StreamSource
- type StreamSourceInfo
- type StreamState
- type StructValidator
- type SubjectTransformConfig
- type UnknownMessage
Examples ¶
Constants ¶
const ( JSApiLeaderStepDown = "$JS.API.META.LEADER.STEPDOWN" JSApiLeaderStepDownPrefix = "$JS.API.META.LEADER.STEPDOWN" JSApiLeaderStepDownT = "$JS.API.META.LEADER.STEPDOWN" JSApiRemoveServer = "$JS.API.SERVER.REMOVE" JSApiRemoveServerPrefix = "$JS.API.SERVER.REMOVE" JSApiPurgeAccountT = "$JS.API.ACCOUNT.PURGE.%s" JSApiPurgeAccountPrefix = "$JS.API.ACCOUNT.PURGE" )
const ( JSApiConsumerCreate = "$JS.API.CONSUMER.CREATE.*" JSApiConsumerCreateEx = "$JS.API.CONSUMER.CREATE.%s.*.>" JSApiConsumerCreateExPrefix = "$JS.API.CONSUMER.CREATE" JSApiConsumerCreateExT = "$JS.API.CONSUMER.CREATE.%s.%s.%s" JSApiConsumerCreatePrefix = "$JS.API.CONSUMER.CREATE" JSApiConsumerCreateT = "$JS.API.CONSUMER.CREATE.%s" JSApiConsumerCreateWithName = "$JS.API.CONSUMER.CREATE.*.>" JSApiConsumerCreateWithNamePrefix = "$JS.API.CONSUMER.CREATE" JSApiConsumerCreateWithNameT = "$JS.API.CONSUMER.CREATE.%s.%s" JSApiConsumerDeletePrefix = "$JS.API.CONSUMER.DELETE" JSApiConsumerDeleteT = "$JS.API.CONSUMER.DELETE.%s.%s" JSApiConsumerInfoPrefix = "$JS.API.CONSUMER.INFO" JSApiConsumerInfoT = "$JS.API.CONSUMER.INFO.%s.%s" JSApiConsumerLeaderStepDown = "$JS.API.CONSUMER.LEADER.STEPDOWN.*.*" JSApiConsumerLeaderStepDownPrefix = "$JS.API.CONSUMER.LEADER.STEPDOWN" JSApiConsumerLeaderStepDownT = "$JS.API.CONSUMER.LEADER.STEPDOWN.%s.%s" JSApiConsumerList = "$JS.API.CONSUMER.LIST.*" JSApiConsumerListPrefix = "$JS.API.CONSUMER.LIST" JSApiConsumerListT = "$JS.API.CONSUMER.LIST.%s" JSApiConsumerNames = "$JS.API.CONSUMER.NAMES.*" JSApiConsumerNamesPrefix = "$JS.API.CONSUMER.NAMES" JSApiConsumerNamesT = "$JS.API.CONSUMER.NAMES.%s" JSApiConsumerPause = "$JS.API.CONSUMER.PAUSE.*.*" JSApiConsumerPausePrefix = "$JS.API.CONSUMER.PAUSE" JSApiConsumerPauseT = "$JS.API.CONSUMER.PAUSE.%s.%s" JSApiConsumerUnpin = "$JS.API.CONSUMER.UNPIN.*.*" JSApiConsumerUnpinPrefix = "$JS.API.CONSUMER.UNPIN" JSApiConsumerUnpinT = "$JS.API.CONSUMER.UNPIN.%s.%s" JSApiDurableCreate = "$JS.API.CONSUMER.DURABLE.CREATE.*.*" JSApiDurableCreatePrefix = "$JS.API.CONSUMER.DURABLE.CREATE" JSApiDurableCreateT = "$JS.API.CONSUMER.DURABLE.CREATE.%s.%s" JSApiRequestNext = "$JS.API.CONSUMER.MSG.NEXT.*.*" JSApiRequestNextPrefix = "$JS.API.CONSUMER.MSG.NEXT" JSApiRequestNextT = "$JS.API.CONSUMER.MSG.NEXT.%s.%s" JSAdvisoryConsumerMaxDeliveryExceedPre = JSAdvisoryPrefix + ".CONSUMER.MAX_DELIVERIES" JSMetricConsumerAckPre = JSMetricPrefix + ".CONSUMER.ACK" )
also update wellKnownSubjectSchemas
const ( JSAuditAdvisory = "$JS.EVENT.ADVISORY.API" JSMetricPrefix = "$JS.EVENT.METRIC" JSAdvisoryPrefix = "$JS.EVENT.ADVISORY" JSApiAccountInfo = "$JS.API.INFO" JSApiAccountInfoPrefix = "$JS.API.INFO" JSMetaCurrentServerLevel = "_nats.level" JSMetaCurrentServerVersion = "_nats.ver" JsMetaRequiredServerLevel = "_nats.req.level" )
Subjects used by the JetStream API
const ( // OK response OK = "+OK" // ErrPrefix is the ERR prefix response ErrPrefix = "-ERR" )
Responses to requests sent to a server from a client.
const ( // JSMsgId used for tracking duplicates JSMsgId = "Nats-Msg-Id" // JSExpectedStream only store the message in this stream JSExpectedStream = "Nats-Expected-Stream" // JSExpectedLastSeq only store the message if stream last sequence matched JSExpectedLastSeq = "Nats-Expected-Last-Sequence" // JSExpectedLastSubjSeq only stores the message if last sequence for this subject matched JSExpectedLastSubjSeq = "Nats-Expected-Last-Subject-Sequence" // JSExpectedLastMsgId only stores the message if previous Nats-Msg-Id header value matches this JSExpectedLastMsgId = "Nats-Expected-Last-Msg-Id" // JSRollup is a header indicating the message being sent should be stored and all past messags should be discarded // the value can be either `all` or `sub` JSRollup = "Nats-Rollup" // JSRollupAll is the value for JSRollup header to replace the entire stream JSRollupAll = "all" // JSRollupSubject is the value for JSRollup header to replace the a single subject JSRollupSubject = "sub" // JSMessageTTL sets a TTL per message JSMessageTTL = "Nats-TTL" // JSSchedulePattern holds a message schedule pattern JSSchedulePattern = "Nats-Schedule" // JSScheduleTTL sets a TTL on the produced message JSScheduleTTL = "Nats-Schedule-TTL" // JSScheduleTarget sets the target subject for the produced message JSScheduleTarget = "Nats-Schedule-Target" // JSRequiredApiLevel indicates that a request requires a certain API level JSRequiredApiLevel = "Nats-Required-Api-Level" )
Headers for publishing
const ( JSAck = "$JS.ACK" JSAckPrefix = "$JS.ACK" JSApiAccountPurge = "$JS.API.ACCOUNT.PURGE.*" JSApiAccountPurgePrefix = "$JS.API.ACCOUNT.PURGE" JSApiAccountPurgeT = "$JS.API.ACCOUNT.PURGE.%s" JSApiMsgDelete = "$JS.API.STREAM.MSG.DELETE.*" JSApiMsgDeletePrefix = "$JS.API.STREAM.MSG.DELETE" JSApiMsgDeleteT = "$JS.API.STREAM.MSG.DELETE.%s" JSApiMsgGet = "$JS.API.STREAM.MSG.GET.*" JSApiMsgGetPrefix = "$JS.API.STREAM.MSG.GET" JSApiMsgGetT = "$JS.API.STREAM.MSG.GET.%s" JSApiServerRemove = "$JS.API.SERVER.REMOVE" JSApiServerRemovePrefix = "$JS.API.SERVER.REMOVE" JSApiServerRemoveT = "$JS.API.SERVER.REMOVE" JSApiStreamCreate = "$JS.API.STREAM.CREATE.*" JSApiStreamCreatePrefix = "$JS.API.STREAM.CREATE" JSApiStreamCreateT = "$JS.API.STREAM.CREATE.%s" JSApiStreamDeletePrefix = "$JS.API.STREAM.DELETE" JSApiStreamDeleteT = "$JS.API.STREAM.DELETE.%s" JSApiStreamInfo = "$JS.API.STREAM.INFO.*" JSApiStreamInfoPrefix = "$JS.API.STREAM.INFO" JSApiStreamInfoT = "$JS.API.STREAM.INFO.%s" JSApiStreamLeaderStepDown = "$JS.API.STREAM.LEADER.STEPDOWN.*" JSApiStreamLeaderStepDownPrefix = "$JS.API.STREAM.LEADER.STEPDOWN" JSApiStreamLeaderStepDownT = "$JS.API.STREAM.LEADER.STEPDOWN.%s" JSApiStreamList = "$JS.API.STREAM.LIST" JSApiStreamListPrefix = "$JS.API.STREAM.LIST" JSApiStreamListT = "$JS.API.STREAM.LIST" JSApiStreamNames = "$JS.API.STREAM.NAMES" JSApiStreamNamesPrefix = "$JS.API.STREAM.NAMES" JSApiStreamNamesT = "$JS.API.STREAM.NAMES" JSApiStreamPurge = "$JS.API.STREAM.PURGE.*" JSApiStreamPurgePrefix = "$JS.API.STREAM.PURGE" JSApiStreamPurgeT = "$JS.API.STREAM.PURGE.%s" JSApiStreamRemovePeer = "$JS.API.STREAM.PEER.REMOVE.*" JSApiStreamRemovePeerPrefix = "$JS.API.STREAM.PEER.REMOVE" JSApiStreamRemovePeerT = "$JS.API.STREAM.PEER.REMOVE.%s" JSApiStreamRestore = "$JS.API.STREAM.RESTORE.*" JSApiStreamRestorePrefix = "$JS.API.STREAM.RESTORE" JSApiStreamRestoreT = "$JS.API.STREAM.RESTORE.%s" JSApiStreamSnapshot = "$JS.API.STREAM.SNAPSHOT.*" JSApiStreamSnapshotPrefix = "$JS.API.STREAM.SNAPSHOT" JSApiStreamSnapshotT = "$JS.API.STREAM.SNAPSHOT.%s" JSApiStreamUpdate = "$JS.API.STREAM.UPDATE.*" JSApiStreamUpdatePrefix = "$JS.API.STREAM.UPDATE" JSApiStreamUpdateT = "$JS.API.STREAM.UPDATE.%s" JSDirectMsgGet = "$JS.API.DIRECT.GET.*" JSDirectMsgGetPrefix = "$JS.API.DIRECT.GET" JSDirectMsgGetT = "$JS.API.DIRECT.GET.%s" StreamDefaultReplicas = 1 StreamMaxReplicas = 5 )
also update wellKnownSubjectSchemas
const ( // DefaultPersistMode specifies the default persist mode. Writes to the stream will immediately be flushed. // The publish acknowledgement will be sent after the persisting completes. DefaultPersistMode = PersistModeType(iota) // AsyncPersistMode specifies writes to the stream will be flushed asynchronously. // The publish acknowledgement may be sent before the persisting completes. // This means writes could be lost if they weren't flushed prior to a hard kill of the server. AsyncPersistMode )
Variables ¶
var ( AckAck = []byte("+ACK") AckNak = []byte("-NAK") AckProgress = []byte("+WPI") AckNext = []byte("+NXT") AckTerm = []byte("+TERM") )
var ErrUnknownApiSubject = errors.New("unknown api subject")
var SchemasRepo = "https://raw.githubusercontent.com/nats-io/jsm.go/master/schemas"
SchemasRepo is the repository holding NATS Schemas
Functions ¶
func IsNatsErr ¶ added in v0.0.26
IsNatsErr determines if a error matches ID, if multiple IDs are given if the error matches any of these the function will be true
func IsNatsError ¶ added in v0.2.0
IsNatsError checks if err is a ApiErr matching code
func IsNatsSchemaType ¶
IsNatsSchemaType determines if a schema type is a valid NATS type. The logic here is currently quite naive while we learn what works best
func NewMessage ¶
NewMessage creates a new instance of the structure matching schema. When unknown creates a UnknownMessage
func ParseAndValidateMessage ¶ added in v0.1.0
func ParseAndValidateMessage(m []byte, validator StructValidator) (schemaType string, msg any, err error)
ParseAndValidateMessage parses the data using ParseMessage() and validates it against the detected schema. Will panic with a nil validator.
func ParseMessage ¶
ParseMessage parses a typed message m and returns event as for example *api.ConsumerAckMetric, all unknown event schemas will be of type *UnknownMessage
Example ¶
// receivedEvent was received over a transport like NATS, webhook or other medium
schema, event, err := ParseMessage([]byte(receivedEvent))
if err != nil {
panic(err.Error())
}
fmt.Printf("Event Type: %s\n", schema)
switch e := event.(type) {
case *jsadvisory.JetStreamAPIAuditV1:
fmt.Printf("API Audit: subject: %s in account %s", e.Subject, e.Client.Account)
default:
fmt.Printf("Unknown event type %s\n", schema)
fmt.Printf("%#v\n", e)
}
Output: Event Type: io.nats.jetstream.advisory.v1.api_audit API Audit: subject: $JS.STREAM.LIST in account $G
func RenderEvent ¶
func RenderEvent(wr io.Writer, e Event, format RenderFormat) error
RenderEvent renders an event in specific format
func RequiredApiLevel ¶ added in v0.3.0
RequiredApiLevel determines the JetStream API level required by a struct, typically a JetStream API Request when a structure implement the ApiLevelAware interface that function will be called instead
func Schema ¶
Schema returns the JSON schema for a NATS specific Schema type like io.nats.jetstream.advisory.v1.api_audit
func SchemaFileForType ¶ added in v0.0.23
SchemaFileForType determines what file on the file system to load for a particular schema type
func SchemaSearch ¶ added in v0.0.19
SchemaSearch searches all known schemas using a regular expression f
func SchemaTypeForMessage ¶
SchemaTypeForMessage retrieves the schema token from a typed message byte stream it does this by doing a small JSON unmarshal and is probably not the fastest.
Returns the schema io.nats.unknown_message for unknown messages
func SchemaURL ¶
SchemaURL parses a typed message m and determines a http address for the JSON schema describing it rooted in SchemasRepo
func SchemaURLForType ¶
SchemaURLForType determines the path to the JSON Schema document describing a typed message given a token like io.nats.jetstream.metric.v1.consumer_ack
func ToCloudEventV1 ¶
ToCloudEventV1 turns a NATS Event into a version 1.0 Cloud Event
func TypeForJetStreamRequestSubjectPrefix ¶ added in v0.3.0
TypeForJetStreamRequestSubjectPrefix returns an empty instance for a certain JetStream request subject prefix
func TypeForJetStreamResponseSubjectPrefix ¶ added in v0.3.0
TypeForJetStreamResponseSubjectPrefix returns an empty instance for a certain JetStream response subject prefix
func TypeForRequestSubject ¶ added in v0.3.0
TypeForRequestSubject matches a type for a request that might include details like $JS.API.CONSUMER.CREATE.foo.bar
Types ¶
type AckPolicy ¶
type AckPolicy int
func (AckPolicy) MarshalJSON ¶
func (AckPolicy) MarshalYAML ¶ added in v0.2.0
func (*AckPolicy) UnmarshalJSON ¶
type ApiError ¶
type ApiError struct {
Code int `json:"code"`
ErrCode uint16 `json:"err_code,omitempty"`
Description string `json:"description,omitempty"`
}
func (ApiError) NatsErrorCode ¶ added in v0.0.25
NatsErrorCode is the unique nats error code, see `nats errors` command
func (ApiError) NotFoundError ¶
NotFoundError is true when the error is one about a resource not found
func (ApiError) ServerError ¶
ServerError is true when the server returns a 5xx error code
type ApiLevelAware ¶ added in v0.3.0
ApiLevelAware is an interface that can be implemented by a struct to indicate that it requires a specific JetStream API level.
type ClusterInfo ¶ added in v0.0.21
type ClusterInfo struct {
Name string `json:"name,omitempty" yaml:"name"`
RaftGroup string `json:"raft_group,omitempty" yaml:"raft_group"`
Leader string `json:"leader,omitempty" yaml:"leader"`
LeaderSince *time.Time `json:"leader_since,omitempty" yaml:"leader_since"`
SystemAcc bool `json:"system_account,omitempty" yaml:"system_account"`
TrafficAcc string `json:"traffic_account,omitempty" yaml:"traffic_account"`
Replicas []*PeerInfo `json:"replicas,omitempty" yaml:"replicas"`
}
ClusterInfo shows information about the underlying set of servers that make up the stream or consumer.
type Compression ¶ added in v0.1.0
type Compression int
const ( NoCompression Compression = iota S2Compression )
func (Compression) MarshalJSON ¶ added in v0.1.0
func (p Compression) MarshalJSON() ([]byte, error)
func (Compression) MarshalYAML ¶ added in v0.1.0
func (p Compression) MarshalYAML() (any, error)
func (Compression) String ¶ added in v0.1.0
func (p Compression) String() string
func (*Compression) UnmarshalJSON ¶ added in v0.1.0
func (p *Compression) UnmarshalJSON(data []byte) error
func (*Compression) UnmarshalYAML ¶ added in v0.1.0
func (p *Compression) UnmarshalYAML(data *yaml.Node) error
type ConsumerAction ¶ added in v0.1.0
type ConsumerAction int
const ( ActionCreateOrUpdate ConsumerAction = iota ActionUpdate ActionCreate )
func (ConsumerAction) MarshalJSON ¶ added in v0.1.0
func (a ConsumerAction) MarshalJSON() ([]byte, error)
func (ConsumerAction) String ¶ added in v0.1.0
func (a ConsumerAction) String() string
func (*ConsumerAction) UnmarshalJSON ¶ added in v0.1.0
func (a *ConsumerAction) UnmarshalJSON(data []byte) error
type ConsumerConfig ¶
type ConsumerConfig struct {
Description string `json:"description,omitempty" yaml:"description"`
AckPolicy AckPolicy `json:"ack_policy" yaml:"ack_policy"`
AckWait time.Duration `json:"ack_wait,omitempty" yaml:"ack_wait"`
DeliverPolicy DeliverPolicy `json:"deliver_policy" yaml:"deliver_policy"`
DeliverSubject string `json:"deliver_subject,omitempty" yaml:"deliver_subject"`
DeliverGroup string `json:"deliver_group,omitempty" yaml:"deliver_group"`
Durable string `json:"durable_name,omitempty" yaml:"durable_name"`
Name string `json:"name,omitempty" yaml:"name"`
FilterSubject string `json:"filter_subject,omitempty" yaml:"filter_subject"`
FilterSubjects []string `json:"filter_subjects,omitempty" yaml:"filter_subjects"`
FlowControl bool `json:"flow_control,omitempty" yaml:"flow_control"`
Heartbeat time.Duration `json:"idle_heartbeat,omitempty" yaml:"idle_heartbeat"`
MaxAckPending int `json:"max_ack_pending,omitempty" yaml:"max_ack_pending"`
MaxDeliver int `json:"max_deliver,omitempty" yaml:"max_deliver"`
BackOff []time.Duration `json:"backoff,omitempty" yaml:"backoff"`
MaxWaiting int `json:"max_waiting,omitempty" yaml:"max_waiting"`
OptStartSeq uint64 `json:"opt_start_seq,omitempty" yaml:"opt_start_seq"`
OptStartTime *time.Time `json:"opt_start_time,omitempty" yaml:"opt_start_time"`
RateLimit uint64 `json:"rate_limit_bps,omitempty" yaml:"rate_limit_bps"`
ReplayPolicy ReplayPolicy `json:"replay_policy" yaml:"replay_policy"`
SampleFrequency string `json:"sample_freq,omitempty" yaml:"sample_freq"`
HeadersOnly bool `json:"headers_only,omitempty" yaml:"headers_only"`
MaxRequestBatch int `json:"max_batch,omitempty" yaml:"max_batch"`
MaxRequestExpires time.Duration `json:"max_expires,omitempty" yaml:"max_expires"`
MaxRequestMaxBytes int `json:"max_bytes,omitempty" yaml:"max_bytes"`
InactiveThreshold time.Duration `json:"inactive_threshold,omitempty" yaml:"inactive_threshold"`
Replicas int `json:"num_replicas" yaml:"num_replicas"`
MemoryStorage bool `json:"mem_storage,omitempty" yaml:"mem_storage"`
// Metadata is additional metadata for the Consumer.
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata"`
// PauseUntil is for suspending the consumer until the deadline.
PauseUntil time.Time `json:"pause_until,omitempty" yaml:"pause_until" api_level:"1"`
// Priority groups
PriorityGroups []string `json:"priority_groups,omitempty" yaml:"priority_groups" api_level:"1"`
PriorityPolicy PriorityPolicy `json:"priority_policy,omitempty" yaml:"priority_policy"`
PinnedTTL time.Duration `json:"priority_timeout,omitempty" yaml:"priority_timeout"`
// Don't add to general clients.
Direct bool `json:"direct,omitempty" yaml:"direct"`
}
ConsumerConfig is the configuration for a JetStream consumes
NATS Schema Type io.nats.jetstream.api.v1.consumer_configuration
func (ConsumerConfig) RequiredApiLevel ¶ added in v0.3.0
func (c ConsumerConfig) RequiredApiLevel() (int, error)
func (ConsumerConfig) Schema ¶
func (t ConsumerConfig) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (ConsumerConfig) SchemaID ¶
func (t ConsumerConfig) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (ConsumerConfig) SchemaType ¶
func (t ConsumerConfig) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_configuration
func (ConsumerConfig) Validate ¶
func (t ConsumerConfig) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type ConsumerInfo ¶
type ConsumerInfo struct {
Stream string `json:"stream_name"`
Name string `json:"name"`
Config ConsumerConfig `json:"config"`
Created time.Time `json:"created"`
Delivered SequenceInfo `json:"delivered"`
AckFloor SequenceInfo `json:"ack_floor"`
NumAckPending int `json:"num_ack_pending"`
NumRedelivered int `json:"num_redelivered"`
NumWaiting int `json:"num_waiting"`
NumPending uint64 `json:"num_pending"`
Cluster *ClusterInfo `json:"cluster,omitempty"`
PushBound bool `json:"push_bound,omitempty"`
Paused bool `json:"paused,omitempty"`
PauseRemaining time.Duration `json:"pause_remaining,omitempty"`
TimeStamp time.Time `json:"ts"`
PriorityGroups []PriorityGroupState `json:"priority_groups,omitempty"`
}
ConsumerInfo reports the current state of a consumer
type ConsumerNakOptions ¶ added in v0.0.29
ConsumerNakOptions is for optional NAK parameters, e.g. delay.
type DeliverPolicy ¶
type DeliverPolicy int
const ( DeliverAll DeliverPolicy = iota DeliverLast DeliverNew DeliverByStartSequence DeliverByStartTime DeliverLastPerSubject )
func (DeliverPolicy) MarshalJSON ¶
func (p DeliverPolicy) MarshalJSON() ([]byte, error)
func (DeliverPolicy) MarshalYAML ¶ added in v0.2.0
func (p DeliverPolicy) MarshalYAML() (any, error)
func (DeliverPolicy) String ¶
func (p DeliverPolicy) String() string
func (*DeliverPolicy) UnmarshalJSON ¶
func (p *DeliverPolicy) UnmarshalJSON(data []byte) error
func (*DeliverPolicy) UnmarshalYAML ¶ added in v0.2.0
func (p *DeliverPolicy) UnmarshalYAML(data *yaml.Node) error
type DiscardPolicy ¶
type DiscardPolicy int
const ( DiscardOld DiscardPolicy = iota DiscardNew )
func (DiscardPolicy) MarshalJSON ¶
func (p DiscardPolicy) MarshalJSON() ([]byte, error)
func (DiscardPolicy) MarshalYAML ¶ added in v0.1.0
func (p DiscardPolicy) MarshalYAML() (any, error)
func (DiscardPolicy) String ¶
func (p DiscardPolicy) String() string
func (*DiscardPolicy) UnmarshalJSON ¶
func (p *DiscardPolicy) UnmarshalJSON(data []byte) error
func (*DiscardPolicy) UnmarshalYAML ¶ added in v0.1.0
func (p *DiscardPolicy) UnmarshalYAML(data *yaml.Node) error
type Event ¶
type Event interface {
EventType() string
EventID() string
EventTime() time.Time
EventSource() string
EventSubject() string
EventTemplate(kind string) (*template.Template, error)
}
Event is a generic NATS Event capable of being converted to CloudEvents format
type ExternalStream ¶ added in v0.0.21
type ExternalStream struct {
ApiPrefix string `json:"api" yaml:"api"`
DeliverPrefix string `json:"deliver" yaml:"deliver"`
}
ExternalStream allows you to qualify access to a stream source in another account.
type JSApiAccountInfoResponse ¶
type JSApiAccountInfoResponse struct {
JSApiResponse
*JetStreamAccountStats
}
io.nats.jetstream.api.v1.account_info_response
func (JSApiAccountInfoResponse) Schema ¶
func (t JSApiAccountInfoResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiAccountInfoResponse) SchemaID ¶
func (t JSApiAccountInfoResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiAccountInfoResponse) SchemaType ¶
func (t JSApiAccountInfoResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.account_info_response
func (JSApiAccountInfoResponse) Validate ¶
func (t JSApiAccountInfoResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiAccountPurgeResponse ¶ added in v0.0.35
type JSApiAccountPurgeResponse struct {
JSApiResponse
Initiated bool `json:"initiated,omitempty"`
}
io.nats.jetstream.api.v1.account_purge_response
func (JSApiAccountPurgeResponse) Schema ¶ added in v0.0.35
func (t JSApiAccountPurgeResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiAccountPurgeResponse) SchemaID ¶ added in v0.0.35
func (t JSApiAccountPurgeResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiAccountPurgeResponse) SchemaType ¶ added in v0.0.35
func (t JSApiAccountPurgeResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.account_purge_response
func (JSApiAccountPurgeResponse) Validate ¶ added in v0.0.35
func (t JSApiAccountPurgeResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerCreateRequest ¶ added in v0.0.18
type JSApiConsumerCreateRequest struct {
Stream string `json:"stream_name"`
Config ConsumerConfig `json:"config"`
Action ConsumerAction `json:"action"`
// Pedantic disables server features that would set defaults and adjust the provided config
Pedantic bool `json:"pedantic,omitempty"`
}
io.nats.jetstream.api.v1.consumer_create_request
func (JSApiConsumerCreateRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerCreateRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerCreateRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerCreateRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerCreateRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerCreateRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerCreateRequest) Schema ¶ added in v0.0.18
func (t JSApiConsumerCreateRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerCreateRequest) SchemaID ¶ added in v0.0.18
func (t JSApiConsumerCreateRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerCreateRequest) SchemaType ¶ added in v0.0.18
func (t JSApiConsumerCreateRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_create_request
func (JSApiConsumerCreateRequest) Validate ¶ added in v0.0.18
func (t JSApiConsumerCreateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerCreateResponse ¶
type JSApiConsumerCreateResponse struct {
JSApiResponse
*ConsumerInfo
}
io.nats.jetstream.api.v1.consumer_create_response
func (JSApiConsumerCreateResponse) Schema ¶
func (t JSApiConsumerCreateResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerCreateResponse) SchemaID ¶
func (t JSApiConsumerCreateResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerCreateResponse) SchemaType ¶
func (t JSApiConsumerCreateResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_create_response
func (JSApiConsumerCreateResponse) Validate ¶
func (t JSApiConsumerCreateResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerDeleteResponse ¶
type JSApiConsumerDeleteResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.consumer_delete_response
func (JSApiConsumerDeleteResponse) Schema ¶
func (t JSApiConsumerDeleteResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerDeleteResponse) SchemaID ¶
func (t JSApiConsumerDeleteResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerDeleteResponse) SchemaType ¶
func (t JSApiConsumerDeleteResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_delete_response
func (JSApiConsumerDeleteResponse) Validate ¶
func (t JSApiConsumerDeleteResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerGetNextRequest ¶ added in v0.0.20
type JSApiConsumerGetNextRequest struct {
Expires time.Duration `json:"expires,omitempty"`
Batch int `json:"batch,omitempty"`
MaxBytes int `json:"max_bytes,omitempty"`
NoWait bool `json:"no_wait,omitempty"`
Heartbeat time.Duration `json:"idle_heartbeat,omitempty"`
Group string `json:"group,omitempty"`
MinPending int64 `json:"min_pending,omitempty"`
MinAckPending int64 `json:"min_ack_pending,omitempty"`
Id string `json:"id,omitempty"`
Priority int `json:"priority,omitempty"`
}
JSApiConsumerGetNextRequest is for getting next messages for pull based consumers
NATS Schema Type io.nats.jetstream.api.v1.consumer_getnext_request
func (JSApiConsumerGetNextRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerGetNextRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerGetNextRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerGetNextRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerGetNextRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerGetNextRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerGetNextRequest) Schema ¶ added in v0.0.20
func (t JSApiConsumerGetNextRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerGetNextRequest) SchemaID ¶ added in v0.0.20
func (t JSApiConsumerGetNextRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerGetNextRequest) SchemaType ¶ added in v0.0.20
func (t JSApiConsumerGetNextRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_getnext_request
func (JSApiConsumerGetNextRequest) Validate ¶ added in v0.0.20
func (t JSApiConsumerGetNextRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerInfoResponse ¶
type JSApiConsumerInfoResponse struct {
JSApiResponse
*ConsumerInfo
}
io.nats.jetstream.api.v1.consumer_info_response
func (JSApiConsumerInfoResponse) Schema ¶
func (t JSApiConsumerInfoResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerInfoResponse) SchemaID ¶
func (t JSApiConsumerInfoResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerInfoResponse) SchemaType ¶
func (t JSApiConsumerInfoResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_info_response
func (JSApiConsumerInfoResponse) Validate ¶
func (t JSApiConsumerInfoResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerLeaderStepDownResponse ¶ added in v0.0.21
type JSApiConsumerLeaderStepDownResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.consumer_leader_stepdown_response
func (JSApiConsumerLeaderStepDownResponse) Schema ¶ added in v0.0.21
func (t JSApiConsumerLeaderStepDownResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerLeaderStepDownResponse) SchemaID ¶ added in v0.0.21
func (t JSApiConsumerLeaderStepDownResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerLeaderStepDownResponse) SchemaType ¶ added in v0.0.21
func (t JSApiConsumerLeaderStepDownResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_leader_stepdown_response
func (JSApiConsumerLeaderStepDownResponse) Validate ¶ added in v0.0.21
func (t JSApiConsumerLeaderStepDownResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerLeaderStepdownRequest ¶ added in v0.2.0
type JSApiConsumerLeaderStepdownRequest struct {
Placement *Placement `json:"placement,omitempty"`
}
io.nats.jetstream.api.v1.consumer_leader_stepdown_request
func (JSApiConsumerLeaderStepdownRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerLeaderStepdownRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerLeaderStepdownRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerLeaderStepdownRequest) Schema ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerLeaderStepdownRequest) SchemaID ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerLeaderStepdownRequest) SchemaType ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_leader_stepdown_request
func (JSApiConsumerLeaderStepdownRequest) Validate ¶ added in v0.3.0
func (t JSApiConsumerLeaderStepdownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerListRequest ¶
type JSApiConsumerListRequest struct {
JSApiIterableRequest
}
io.nats.jetstream.api.v1.consumer_list_request
func (JSApiConsumerListRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerListRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerListRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerListRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerListRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerListRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerListRequest) Schema ¶
func (t JSApiConsumerListRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerListRequest) SchemaID ¶
func (t JSApiConsumerListRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerListRequest) SchemaType ¶
func (t JSApiConsumerListRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_list_request
func (JSApiConsumerListRequest) Validate ¶
func (t JSApiConsumerListRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerListResponse ¶
type JSApiConsumerListResponse struct {
JSApiResponse
JSApiIterableResponse
Consumers []*ConsumerInfo `json:"consumers"`
Missing []string `json:"missing,omitempty"`
Offline map[string]string `json:"offline,omitempty"`
}
io.nats.jetstream.api.v1.consumer_list_response
func (JSApiConsumerListResponse) Schema ¶
func (t JSApiConsumerListResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerListResponse) SchemaID ¶
func (t JSApiConsumerListResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerListResponse) SchemaType ¶
func (t JSApiConsumerListResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_list_response
func (JSApiConsumerListResponse) Validate ¶
func (t JSApiConsumerListResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerNamesRequest ¶
type JSApiConsumerNamesRequest struct {
JSApiIterableRequest
}
io.nats.jetstream.api.v1.consumer_names_request
func (JSApiConsumerNamesRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerNamesRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerNamesRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerNamesRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerNamesRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerNamesRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerNamesRequest) Schema ¶
func (t JSApiConsumerNamesRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerNamesRequest) SchemaID ¶
func (t JSApiConsumerNamesRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerNamesRequest) SchemaType ¶
func (t JSApiConsumerNamesRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_names_request
func (JSApiConsumerNamesRequest) Validate ¶
func (t JSApiConsumerNamesRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerNamesResponse ¶
type JSApiConsumerNamesResponse struct {
JSApiResponse
JSApiIterableResponse
Consumers []string `json:"consumers"`
}
io.nats.jetstream.api.v1.consumer_names_response
func (JSApiConsumerNamesResponse) Schema ¶
func (t JSApiConsumerNamesResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerNamesResponse) SchemaID ¶
func (t JSApiConsumerNamesResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerNamesResponse) SchemaType ¶
func (t JSApiConsumerNamesResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_names_response
func (JSApiConsumerNamesResponse) Validate ¶
func (t JSApiConsumerNamesResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerPauseRequest ¶ added in v0.2.0
type JSApiConsumerPauseRequest struct {
PauseUntil time.Time `json:"pause_until,omitempty" api_level:"1"`
}
io.nats.jetstream.api.v1.consumer_pause_request
func (JSApiConsumerPauseRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerPauseRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerPauseRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerPauseRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerPauseRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerPauseRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerPauseRequest) Schema ¶ added in v0.2.0
func (t JSApiConsumerPauseRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerPauseRequest) SchemaID ¶ added in v0.2.0
func (t JSApiConsumerPauseRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerPauseRequest) SchemaType ¶ added in v0.2.0
func (t JSApiConsumerPauseRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_pause_request
func (JSApiConsumerPauseRequest) Validate ¶ added in v0.2.0
func (t JSApiConsumerPauseRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerPauseResponse ¶ added in v0.2.0
type JSApiConsumerPauseResponse struct {
JSApiResponse
Paused bool `json:"paused"`
PauseUntil time.Time `json:"pause_until"`
PauseRemaining time.Duration `json:"pause_remaining,omitempty"`
}
io.nats.jetstream.api.v1.consumer_pause_response
func (JSApiConsumerPauseResponse) Schema ¶ added in v0.2.0
func (t JSApiConsumerPauseResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerPauseResponse) SchemaID ¶ added in v0.2.0
func (t JSApiConsumerPauseResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerPauseResponse) SchemaType ¶ added in v0.2.0
func (t JSApiConsumerPauseResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_pause_response
func (JSApiConsumerPauseResponse) Validate ¶ added in v0.2.0
func (t JSApiConsumerPauseResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerUnpinRequest ¶ added in v0.2.0
type JSApiConsumerUnpinRequest struct {
Group string `json:"group"`
}
io.nats.jetstream.api.v1.consumer_unpin_request
func (JSApiConsumerUnpinRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiConsumerUnpinRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiConsumerUnpinRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiConsumerUnpinRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiConsumerUnpinRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiConsumerUnpinRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiConsumerUnpinRequest) Schema ¶ added in v0.2.1
func (t JSApiConsumerUnpinRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerUnpinRequest) SchemaID ¶ added in v0.2.1
func (t JSApiConsumerUnpinRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerUnpinRequest) SchemaType ¶ added in v0.2.1
func (t JSApiConsumerUnpinRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_unpin_request
func (JSApiConsumerUnpinRequest) Validate ¶ added in v0.2.1
func (t JSApiConsumerUnpinRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiConsumerUnpinResponse ¶ added in v0.2.0
type JSApiConsumerUnpinResponse struct {
JSApiResponse
}
io.nats.jetstream.api.v1.consumer_unpin_response
func (JSApiConsumerUnpinResponse) Schema ¶ added in v0.2.1
func (t JSApiConsumerUnpinResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiConsumerUnpinResponse) SchemaID ¶ added in v0.2.1
func (t JSApiConsumerUnpinResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiConsumerUnpinResponse) SchemaType ¶ added in v0.2.1
func (t JSApiConsumerUnpinResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.consumer_unpin_response
func (JSApiConsumerUnpinResponse) Validate ¶ added in v0.2.1
func (t JSApiConsumerUnpinResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiIterableRequest ¶
type JSApiIterableRequest struct {
Offset int `json:"offset"`
}
func (*JSApiIterableRequest) SetOffset ¶
func (i *JSApiIterableRequest) SetOffset(o int)
type JSApiIterableResponse ¶
type JSApiIterableResponse struct {
Total int `json:"total"`
Offset int `json:"offset"`
Limit int `json:"limit"`
}
func (JSApiIterableResponse) ItemsLimit ¶
func (i JSApiIterableResponse) ItemsLimit() int
func (JSApiIterableResponse) ItemsOffset ¶
func (i JSApiIterableResponse) ItemsOffset() int
func (JSApiIterableResponse) ItemsTotal ¶
func (i JSApiIterableResponse) ItemsTotal() int
func (JSApiIterableResponse) LastPage ¶
func (i JSApiIterableResponse) LastPage() bool
type JSApiLeaderStepDownRequest ¶ added in v0.0.21
type JSApiLeaderStepDownRequest struct {
Placement *Placement `json:"placement,omitempty"`
}
io.nats.jetstream.api.v1.meta_leader_stepdown_request
func (JSApiLeaderStepDownRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiLeaderStepDownRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiLeaderStepDownRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiLeaderStepDownRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiLeaderStepDownRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiLeaderStepDownRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiLeaderStepDownRequest) Schema ¶ added in v0.0.21
func (t JSApiLeaderStepDownRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiLeaderStepDownRequest) SchemaID ¶ added in v0.0.21
func (t JSApiLeaderStepDownRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiLeaderStepDownRequest) SchemaType ¶ added in v0.0.21
func (t JSApiLeaderStepDownRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.meta_leader_stepdown_request
func (JSApiLeaderStepDownRequest) Validate ¶ added in v0.0.21
func (t JSApiLeaderStepDownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiLeaderStepDownResponse ¶ added in v0.0.21
type JSApiLeaderStepDownResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.meta_leader_stepdown_response
func (JSApiLeaderStepDownResponse) Schema ¶ added in v0.0.21
func (t JSApiLeaderStepDownResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiLeaderStepDownResponse) SchemaID ¶ added in v0.0.21
func (t JSApiLeaderStepDownResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiLeaderStepDownResponse) SchemaType ¶ added in v0.0.21
func (t JSApiLeaderStepDownResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.meta_leader_stepdown_response
func (JSApiLeaderStepDownResponse) Validate ¶ added in v0.0.21
func (t JSApiLeaderStepDownResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMetaServerRemoveRequest ¶ added in v0.0.21
type JSApiMetaServerRemoveRequest struct {
// Server name of the peer to be removed.
Server string `json:"peer"`
// Peer ID of the peer to be removed. If specified this is used
// instead of the server name.
Peer string `json:"peer_id,omitempty"`
}
io.nats.jetstream.api.v1.meta_server_remove_request
func (JSApiMetaServerRemoveRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiMetaServerRemoveRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiMetaServerRemoveRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiMetaServerRemoveRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiMetaServerRemoveRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiMetaServerRemoveRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiMetaServerRemoveRequest) Schema ¶ added in v0.0.21
func (t JSApiMetaServerRemoveRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMetaServerRemoveRequest) SchemaID ¶ added in v0.0.21
func (t JSApiMetaServerRemoveRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMetaServerRemoveRequest) SchemaType ¶ added in v0.0.21
func (t JSApiMetaServerRemoveRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.meta_server_remove_request
func (JSApiMetaServerRemoveRequest) Validate ¶ added in v0.0.21
func (t JSApiMetaServerRemoveRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMetaServerRemoveResponse ¶ added in v0.0.21
type JSApiMetaServerRemoveResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.meta_server_remove_response
func (JSApiMetaServerRemoveResponse) Schema ¶ added in v0.0.21
func (t JSApiMetaServerRemoveResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMetaServerRemoveResponse) SchemaID ¶ added in v0.0.21
func (t JSApiMetaServerRemoveResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMetaServerRemoveResponse) SchemaType ¶ added in v0.0.21
func (t JSApiMetaServerRemoveResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.meta_server_remove_response
func (JSApiMetaServerRemoveResponse) Validate ¶ added in v0.0.21
func (t JSApiMetaServerRemoveResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMsgDeleteRequest ¶
type JSApiMsgDeleteRequest struct {
// Seq is the message sequence to delete
Seq uint64 `json:"seq"`
// NoErase avoids overwriting the message data with random bytes
NoErase bool `json:"no_erase,omitempty"`
}
io.nats.jetstream.api.v1.stream_msg_delete_request
func (JSApiMsgDeleteRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiMsgDeleteRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiMsgDeleteRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiMsgDeleteRequest) Schema ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMsgDeleteRequest) SchemaID ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMsgDeleteRequest) SchemaType ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_msg_delete_request
func (JSApiMsgDeleteRequest) Validate ¶ added in v0.3.0
func (t JSApiMsgDeleteRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMsgDeleteResponse ¶
type JSApiMsgDeleteResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.stream_msg_delete_response
func (JSApiMsgDeleteResponse) Schema ¶
func (t JSApiMsgDeleteResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMsgDeleteResponse) SchemaID ¶
func (t JSApiMsgDeleteResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMsgDeleteResponse) SchemaType ¶
func (t JSApiMsgDeleteResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_msg_delete_response
func (JSApiMsgDeleteResponse) Validate ¶
func (t JSApiMsgDeleteResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMsgGetRequest ¶
type JSApiMsgGetRequest struct {
Seq uint64 `json:"seq,omitempty"`
LastFor string `json:"last_by_subj,omitempty"`
NextFor string `json:"next_by_subj,omitempty"`
// Batch support. Used to request more then one msg at a time.
// Can be used with simple starting seq, but also NextFor with wildcards.
Batch int `json:"batch,omitempty"`
// This will make sure we limit how much data we blast out. If not set we will
// inherit the slow consumer default max setting of the server. Default is MAX_PENDING_SIZE.
MaxBytes int `json:"max_bytes,omitempty"`
// Return messages as of this start time.
StartTime *time.Time `json:"start_time,omitempty"`
// Multiple response support. Will get the last msgs matching the subjects. These can include wildcards.
MultiLastFor []string `json:"multi_last,omitempty"`
// Only return messages up to this sequence. If not set, will be last sequence for the stream.
UpToSeq uint64 `json:"up_to_seq,omitempty"`
// Only return messages up to this time.
UpToTime *time.Time `json:"up_to_time,omitempty"`
}
io.nats.jetstream.api.v1.stream_msg_get_request
func (JSApiMsgGetRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiMsgGetRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiMsgGetRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiMsgGetRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiMsgGetRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiMsgGetRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiMsgGetRequest) Schema ¶
func (t JSApiMsgGetRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMsgGetRequest) SchemaID ¶
func (t JSApiMsgGetRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMsgGetRequest) SchemaType ¶
func (t JSApiMsgGetRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_msg_get_request
func (JSApiMsgGetRequest) Validate ¶
func (t JSApiMsgGetRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiMsgGetResponse ¶
type JSApiMsgGetResponse struct {
JSApiResponse
Message *StoredMsg `json:"message,omitempty"`
}
io.nats.jetstream.api.v1.stream_msg_get_response
func (JSApiMsgGetResponse) Schema ¶
func (t JSApiMsgGetResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiMsgGetResponse) SchemaID ¶
func (t JSApiMsgGetResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiMsgGetResponse) SchemaType ¶
func (t JSApiMsgGetResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_msg_get_response
func (JSApiMsgGetResponse) Validate ¶
func (t JSApiMsgGetResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiResponse ¶
func (JSApiResponse) IsError ¶
func (r JSApiResponse) IsError() bool
IsError determines if a standard JetStream API response is a error
func (JSApiResponse) ToError ¶
func (r JSApiResponse) ToError() error
ToError extracts a standard error from a JetStream response
type JSApiStreamCreateRequest ¶ added in v0.0.20
type JSApiStreamCreateRequest struct {
StreamConfig
// Pedantic disables server features that would set defaults and adjust the provided config
Pedantic bool `json:"pedantic,omitempty"`
}
io.nats.jetstream.api.v1.stream_create_request
func (JSApiStreamCreateRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamCreateRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamCreateRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamCreateRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamCreateRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamCreateRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamCreateRequest) Schema ¶ added in v0.0.20
func (t JSApiStreamCreateRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamCreateRequest) SchemaID ¶ added in v0.0.20
func (t JSApiStreamCreateRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamCreateRequest) SchemaType ¶ added in v0.0.20
func (t JSApiStreamCreateRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_create_request
func (JSApiStreamCreateRequest) Validate ¶ added in v0.0.20
func (t JSApiStreamCreateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamCreateResponse ¶
type JSApiStreamCreateResponse struct {
JSApiResponse
*StreamInfo
}
io.nats.jetstream.api.v1.stream_create_response
func (JSApiStreamCreateResponse) Schema ¶
func (t JSApiStreamCreateResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamCreateResponse) SchemaID ¶
func (t JSApiStreamCreateResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamCreateResponse) SchemaType ¶
func (t JSApiStreamCreateResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_create_response
func (JSApiStreamCreateResponse) Validate ¶
func (t JSApiStreamCreateResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamDeleteResponse ¶
type JSApiStreamDeleteResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.stream_delete_response
func (JSApiStreamDeleteResponse) Schema ¶
func (t JSApiStreamDeleteResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamDeleteResponse) SchemaID ¶
func (t JSApiStreamDeleteResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamDeleteResponse) SchemaType ¶
func (t JSApiStreamDeleteResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_delete_response
func (JSApiStreamDeleteResponse) Validate ¶
func (t JSApiStreamDeleteResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamInfoRequest ¶ added in v0.0.23
type JSApiStreamInfoRequest struct {
JSApiIterableRequest
DeletedDetails bool `json:"deleted_details,omitempty"`
SubjectsFilter string `json:"subjects_filter,omitempty"`
}
io.nats.jetstream.api.v1.stream_info_request
func (JSApiStreamInfoRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamInfoRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamInfoRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamInfoRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamInfoRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamInfoRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamInfoRequest) Schema ¶ added in v0.0.23
func (t JSApiStreamInfoRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamInfoRequest) SchemaID ¶ added in v0.0.23
func (t JSApiStreamInfoRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamInfoRequest) SchemaType ¶ added in v0.0.23
func (t JSApiStreamInfoRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_info_request
func (JSApiStreamInfoRequest) Validate ¶ added in v0.0.23
func (t JSApiStreamInfoRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamInfoResponse ¶
type JSApiStreamInfoResponse struct {
JSApiResponse
JSApiIterableResponse
*StreamInfo
}
io.nats.jetstream.api.v1.stream_info_response
func (JSApiStreamInfoResponse) Schema ¶
func (t JSApiStreamInfoResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamInfoResponse) SchemaID ¶
func (t JSApiStreamInfoResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamInfoResponse) SchemaType ¶
func (t JSApiStreamInfoResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_info_response
func (JSApiStreamInfoResponse) Validate ¶
func (t JSApiStreamInfoResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamLeaderStepDownRequest ¶ added in v0.3.0
type JSApiStreamLeaderStepDownRequest struct {
Placement *Placement `json:"placement,omitempty"`
}
io.nats.jetstream.api.v1.stream_leader_stepdown_request
func (JSApiStreamLeaderStepDownRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamLeaderStepDownRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamLeaderStepDownRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamLeaderStepDownRequest) Schema ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamLeaderStepDownRequest) SchemaID ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamLeaderStepDownRequest) SchemaType ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_leader_stepdown_request
func (JSApiStreamLeaderStepDownRequest) Validate ¶ added in v0.3.0
func (t JSApiStreamLeaderStepDownRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamLeaderStepDownResponse ¶ added in v0.0.21
type JSApiStreamLeaderStepDownResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.stream_leader_stepdown_response
func (JSApiStreamLeaderStepDownResponse) Schema ¶ added in v0.0.21
func (t JSApiStreamLeaderStepDownResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamLeaderStepDownResponse) SchemaID ¶ added in v0.0.21
func (t JSApiStreamLeaderStepDownResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamLeaderStepDownResponse) SchemaType ¶ added in v0.0.21
func (t JSApiStreamLeaderStepDownResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_leader_stepdown_response
func (JSApiStreamLeaderStepDownResponse) Validate ¶ added in v0.0.21
func (t JSApiStreamLeaderStepDownResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamListRequest ¶
type JSApiStreamListRequest struct {
JSApiIterableRequest
// Subject filter the names to those consuming messages matching this subject or wildcard
Subject string `json:"subject,omitempty"`
}
io.nats.jetstream.api.v1.stream_list_request
func (JSApiStreamListRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamListRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamListRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamListRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamListRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamListRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamListRequest) Schema ¶
func (t JSApiStreamListRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamListRequest) SchemaID ¶
func (t JSApiStreamListRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamListRequest) SchemaType ¶
func (t JSApiStreamListRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_list_request
func (JSApiStreamListRequest) Validate ¶
func (t JSApiStreamListRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamListResponse ¶
type JSApiStreamListResponse struct {
JSApiResponse
JSApiIterableResponse
Streams []*StreamInfo `json:"streams"`
Missing []string `json:"missing,omitempty"`
Offline map[string]string `json:"offline,omitempty"`
}
io.nats.jetstream.api.v1.stream_list_response
func (JSApiStreamListResponse) Schema ¶
func (t JSApiStreamListResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamListResponse) SchemaID ¶
func (t JSApiStreamListResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamListResponse) SchemaType ¶
func (t JSApiStreamListResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_list_response
func (JSApiStreamListResponse) Validate ¶
func (t JSApiStreamListResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamNamesRequest ¶
type JSApiStreamNamesRequest struct {
JSApiIterableRequest
// Subject filter the names to those consuming messages matching this subject or wildcard
Subject string `json:"subject,omitempty"`
}
io.nats.jetstream.api.v1.stream_names_request
func (JSApiStreamNamesRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamNamesRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamNamesRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamNamesRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamNamesRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamNamesRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamNamesRequest) Schema ¶
func (t JSApiStreamNamesRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamNamesRequest) SchemaID ¶
func (t JSApiStreamNamesRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamNamesRequest) SchemaType ¶
func (t JSApiStreamNamesRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_names_request
func (JSApiStreamNamesRequest) Validate ¶
func (t JSApiStreamNamesRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamNamesResponse ¶
type JSApiStreamNamesResponse struct {
JSApiResponse
JSApiIterableResponse
Streams []string `json:"streams"`
}
io.nats.jetstream.api.v1.stream_names_response
func (JSApiStreamNamesResponse) Schema ¶
func (t JSApiStreamNamesResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamNamesResponse) SchemaID ¶
func (t JSApiStreamNamesResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamNamesResponse) SchemaType ¶
func (t JSApiStreamNamesResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_names_response
func (JSApiStreamNamesResponse) Validate ¶
func (t JSApiStreamNamesResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamPurgeRequest ¶ added in v0.0.24
type JSApiStreamPurgeRequest struct {
// Purge up to but not including sequence.
Sequence uint64 `json:"seq,omitempty"`
// Subject to match against messages for the purge command.
Subject string `json:"filter,omitempty"`
// Number of messages to keep.
Keep uint64 `json:"keep,omitempty"`
}
JSApiStreamPurgeRequest is optional request information to the purge API. Subject will filter the purge request to only messages that match the subject, which can have wildcards. Sequence will purge up to but not including this sequence and can be combined with subject filtering. Keep will specify how many messages to keep. This can also be combined with subject filtering. Note that Sequence and Keep are mutually exclusive, so both can not be set at the same time.
func (JSApiStreamPurgeRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamPurgeRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamPurgeRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamPurgeRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamPurgeRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamPurgeRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamPurgeRequest) Schema ¶ added in v0.0.27
func (t JSApiStreamPurgeRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamPurgeRequest) SchemaID ¶ added in v0.0.27
func (t JSApiStreamPurgeRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamPurgeRequest) SchemaType ¶ added in v0.0.27
func (t JSApiStreamPurgeRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_purge_request
func (JSApiStreamPurgeRequest) Validate ¶ added in v0.0.27
func (t JSApiStreamPurgeRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamPurgeResponse ¶
type JSApiStreamPurgeResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
Purged uint64 `json:"purged"`
}
io.nats.jetstream.api.v1.stream_purge_response
func (JSApiStreamPurgeResponse) Schema ¶
func (t JSApiStreamPurgeResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamPurgeResponse) SchemaID ¶
func (t JSApiStreamPurgeResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamPurgeResponse) SchemaType ¶
func (t JSApiStreamPurgeResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_purge_response
func (JSApiStreamPurgeResponse) Validate ¶
func (t JSApiStreamPurgeResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamRemovePeerRequest ¶ added in v0.0.21
type JSApiStreamRemovePeerRequest struct {
// Server name of the peer to be removed.
Peer string `json:"peer"`
}
io.nats.jetstream.api.v1.stream_remove_peer_request
func (JSApiStreamRemovePeerRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamRemovePeerRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamRemovePeerRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamRemovePeerRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamRemovePeerRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamRemovePeerRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamRemovePeerRequest) Schema ¶ added in v0.0.21
func (t JSApiStreamRemovePeerRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamRemovePeerRequest) SchemaID ¶ added in v0.0.21
func (t JSApiStreamRemovePeerRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamRemovePeerRequest) SchemaType ¶ added in v0.0.21
func (t JSApiStreamRemovePeerRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_remove_peer_request
func (JSApiStreamRemovePeerRequest) Validate ¶ added in v0.0.21
func (t JSApiStreamRemovePeerRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamRemovePeerResponse ¶ added in v0.0.21
type JSApiStreamRemovePeerResponse struct {
JSApiResponse
Success bool `json:"success,omitempty"`
}
io.nats.jetstream.api.v1.stream_remove_peer_response
func (JSApiStreamRemovePeerResponse) Schema ¶ added in v0.0.21
func (t JSApiStreamRemovePeerResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamRemovePeerResponse) SchemaID ¶ added in v0.0.21
func (t JSApiStreamRemovePeerResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamRemovePeerResponse) SchemaType ¶ added in v0.0.21
func (t JSApiStreamRemovePeerResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_remove_peer_response
func (JSApiStreamRemovePeerResponse) Validate ¶ added in v0.0.21
func (t JSApiStreamRemovePeerResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamRestoreRequest ¶ added in v0.0.21
type JSApiStreamRestoreRequest struct {
Config StreamConfig `json:"config"`
State StreamState `json:"state"`
}
io.nats.jetstream.api.v1.stream_restore_request
func (JSApiStreamRestoreRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamRestoreRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamRestoreRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamRestoreRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamRestoreRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamRestoreRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamRestoreRequest) Schema ¶ added in v0.0.21
func (t JSApiStreamRestoreRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamRestoreRequest) SchemaID ¶ added in v0.0.21
func (t JSApiStreamRestoreRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamRestoreRequest) SchemaType ¶ added in v0.0.21
func (t JSApiStreamRestoreRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_restore_request
func (JSApiStreamRestoreRequest) Validate ¶ added in v0.0.21
func (t JSApiStreamRestoreRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamRestoreResponse ¶
type JSApiStreamRestoreResponse struct {
JSApiResponse
// Subject to deliver the chunks to for the snapshot restore.
DeliverSubject string `json:"deliver_subject"`
}
io.nats.jetstream.api.v1.stream_restore_response
func (JSApiStreamRestoreResponse) Schema ¶
func (t JSApiStreamRestoreResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamRestoreResponse) SchemaID ¶
func (t JSApiStreamRestoreResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamRestoreResponse) SchemaType ¶
func (t JSApiStreamRestoreResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_restore_response
func (JSApiStreamRestoreResponse) Validate ¶
func (t JSApiStreamRestoreResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamSnapshotRequest ¶
type JSApiStreamSnapshotRequest struct {
// Subject to deliver the chunks to for the snapshot.
DeliverSubject string `json:"deliver_subject"`
// Do not include consumers in the snapshot.
NoConsumers bool `json:"no_consumers,omitempty"`
// Optional chunk size preference. Otherwise server selects.
ChunkSize int `json:"chunk_size,omitempty"`
// Check all message's checksums prior to snapshot.
CheckMsgs bool `json:"jsck,omitempty"`
}
io.nats.jetstream.api.v1.stream_snapshot_request
func (JSApiStreamSnapshotRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamSnapshotRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamSnapshotRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamSnapshotRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamSnapshotRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamSnapshotRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamSnapshotRequest) Schema ¶
func (t JSApiStreamSnapshotRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamSnapshotRequest) SchemaID ¶
func (t JSApiStreamSnapshotRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamSnapshotRequest) SchemaType ¶
func (t JSApiStreamSnapshotRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_snapshot_request
func (JSApiStreamSnapshotRequest) Validate ¶
func (t JSApiStreamSnapshotRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamSnapshotResponse ¶
type JSApiStreamSnapshotResponse struct {
JSApiResponse
Config StreamConfig `json:"config"`
State StreamState `json:"state"`
}
io.nats.jetstream.api.v1.stream_snapshot_response
func (JSApiStreamSnapshotResponse) Schema ¶
func (t JSApiStreamSnapshotResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamSnapshotResponse) SchemaID ¶
func (t JSApiStreamSnapshotResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamSnapshotResponse) SchemaType ¶
func (t JSApiStreamSnapshotResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_snapshot_response
func (JSApiStreamSnapshotResponse) Validate ¶
func (t JSApiStreamSnapshotResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamUpdateRequest ¶ added in v0.3.0
type JSApiStreamUpdateRequest struct {
StreamConfig
// Pedantic disables server features that would set defaults and adjust the provided config
Pedantic bool `json:"pedantic,omitempty"`
}
io.nats.jetstream.api.v1.stream_update_request
func (JSApiStreamUpdateRequest) ApiSubjectFormat ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) ApiSubjectFormat() (string, error)
ApiSubjectFormat returns the NATS subject for the API request subject usable with Sprintf()
func (JSApiStreamUpdateRequest) ApiSubjectPattern ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) ApiSubjectPattern() (string, error)
ApiSubjectPattern returns the NATS subject for the API request subject, may include NATS Subject wildcards
func (JSApiStreamUpdateRequest) ApiSubjectPrefix ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) ApiSubjectPrefix() (string, error)
ApiSubjectPrefix returns the NATS subject for the API request subject that prefixes any patterns or stream/consumer specific names
func (JSApiStreamUpdateRequest) Schema ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamUpdateRequest) SchemaID ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamUpdateRequest) SchemaType ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_update_request
func (JSApiStreamUpdateRequest) Validate ¶ added in v0.3.0
func (t JSApiStreamUpdateRequest) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSApiStreamUpdateResponse ¶
type JSApiStreamUpdateResponse struct {
JSApiResponse
*StreamInfo
}
io.nats.jetstream.api.v1.stream_update_response
func (JSApiStreamUpdateResponse) Schema ¶
func (t JSApiStreamUpdateResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSApiStreamUpdateResponse) SchemaID ¶
func (t JSApiStreamUpdateResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSApiStreamUpdateResponse) SchemaType ¶
func (t JSApiStreamUpdateResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_update_response
func (JSApiStreamUpdateResponse) Validate ¶
func (t JSApiStreamUpdateResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JSPubAckResponse ¶ added in v0.0.20
io.nats.jetstream.api.v1.pub_ack_response
func (JSPubAckResponse) Schema ¶ added in v0.0.20
func (t JSPubAckResponse) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (JSPubAckResponse) SchemaID ¶ added in v0.0.20
func (t JSPubAckResponse) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (JSPubAckResponse) SchemaType ¶ added in v0.0.20
func (t JSPubAckResponse) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.pub_ack_response
func (JSPubAckResponse) Validate ¶ added in v0.0.20
func (t JSPubAckResponse) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type JetStreamAPIStats ¶ added in v0.0.21
type JetStreamAccountLimits ¶
type JetStreamAccountLimits struct {
MaxMemory int64 `json:"max_memory"`
MaxStore int64 `json:"max_storage"`
MaxStreams int `json:"max_streams"`
MaxConsumers int `json:"max_consumers"`
MaxAckPending int `json:"max_ack_pending"`
MemoryMaxStreamBytes int64 `json:"memory_max_stream_bytes"`
StoreMaxStreamBytes int64 `json:"storage_max_stream_bytes"`
MaxBytesRequired bool `json:"max_bytes_required"`
}
type JetStreamAccountStats ¶
type JetStreamAccountStats struct {
JetStreamTier // in case tiers are used, reflects totals with limits not set
Domain string `json:"domain,omitempty"`
API JetStreamAPIStats `json:"api"`
Tiers map[string]JetStreamTier `json:"tiers,omitempty"` // indexed by tier name
}
JetStreamAccountStats returns current statistics about the account's JetStream usage.
type JetStreamTier ¶ added in v0.0.31
type Logger ¶ added in v0.2.0
type Logger interface {
Tracef(format string, a ...any)
Debugf(format string, a ...any)
Infof(format string, a ...any)
Warnf(format string, a ...any)
Errorf(format string, a ...any)
}
func NewDefaultLogger ¶ added in v0.2.0
func NewDiscardLogger ¶ added in v0.2.0
func NewDiscardLogger() Logger
type LostStreamData ¶ added in v0.0.21
type LostStreamData struct {
// Message IDs of lost messages
Msgs []uint64 `json:"msgs" yaml:"msgs"`
// How many bytes were lost
Bytes uint64 `json:"bytes" yaml:"bytes"`
}
LostStreamData indicates msgs that have been lost during file checks and recover due to corruption
type PeerInfo ¶ added in v0.0.21
type PeerInfo struct {
Name string `json:"name" yaml:"name"`
Current bool `json:"current" yaml:"current"`
Observer bool `json:"observer,omitempty" yaml:"observer"`
Offline bool `json:"offline,omitempty" yaml:"offline"`
Active time.Duration `json:"active" yaml:"active"`
Lag uint64 `json:"lag,omitempty" yaml:"lag"`
}
PeerInfo shows information about all the peers in the cluster that are supporting the stream or consumer.
type PersistModeType ¶ added in v0.3.0
type PersistModeType int
func (PersistModeType) MarshalJSON ¶ added in v0.3.0
func (wc PersistModeType) MarshalJSON() ([]byte, error)
func (PersistModeType) MarshalYAML ¶ added in v0.3.0
func (wc PersistModeType) MarshalYAML() (any, error)
func (PersistModeType) String ¶ added in v0.3.0
func (wc PersistModeType) String() string
func (*PersistModeType) UnmarshalJSON ¶ added in v0.3.0
func (wc *PersistModeType) UnmarshalJSON(data []byte) error
func (*PersistModeType) UnmarshalYAML ¶ added in v0.3.0
func (wc *PersistModeType) UnmarshalYAML(data *yaml.Node) error
type Placement ¶ added in v0.0.21
type Placement struct {
Cluster string `json:"cluster,omitempty" yaml:"cluster"`
Tags []string `json:"tags,omitempty" yaml:"tags"`
Preferred string `json:"preferred,omitempty" yaml:"preferred"`
}
Placement describes stream placement requirements for a stream or leader
type PriorityGroupState ¶ added in v0.2.0
type PriorityGroupState struct {
Group string `json:"group"`
PinnedClientID string `json:"pinned_client_id,omitempty"`
PinnedTS time.Time `json:"pinned_ts,omitempty"`
}
PriorityGroupState is the state of a consumer group
type PriorityPolicy ¶ added in v0.2.0
type PriorityPolicy int
PriorityPolicy determines policy for selecting messages based on priority.
const ( PriorityNone PriorityPolicy = iota PriorityOverflow PriorityPinnedClient PriorityPrioritized )
func (PriorityPolicy) MarshalJSON ¶ added in v0.2.0
func (p PriorityPolicy) MarshalJSON() ([]byte, error)
func (PriorityPolicy) MarshalYAML ¶ added in v0.2.0
func (p PriorityPolicy) MarshalYAML() (any, error)
func (PriorityPolicy) String ¶ added in v0.2.0
func (p PriorityPolicy) String() string
func (*PriorityPolicy) UnmarshalJSON ¶ added in v0.2.0
func (p *PriorityPolicy) UnmarshalJSON(data []byte) error
func (*PriorityPolicy) UnmarshalYAML ¶ added in v0.2.0
func (p *PriorityPolicy) UnmarshalYAML(data *yaml.Node) error
type PubAck ¶ added in v0.0.20
type PubAck struct {
Stream string `json:"stream"`
Sequence uint64 `json:"seq"`
Domain string `json:"domain,omitempty"`
Duplicate bool `json:"duplicate,omitempty"`
Value string `json:"val,omitempty"`
BatchId string `json:"batch,omitempty"`
BatchSize int `json:"count,omitempty"`
}
PubAck is the detail you get back from a publish to a stream that was successful
type RePublish ¶ added in v0.0.34
type RePublish struct {
Source string `json:"src,omitempty" yaml:"src"`
Destination string `json:"dest" yaml:"dest"`
HeadersOnly bool `json:"headers_only,omitempty" yaml:"headers_only"`
}
RePublish allows a source subject to be mapped to a destination subject for republishing.
type RenderFormat ¶
type RenderFormat string
RenderFormat indicates the format to render templates in
const ( // TextCompactFormat renders a single line view of an event TextCompactFormat RenderFormat = "text/compact" // TextExtendedFormat renders a multi line full view of an event TextExtendedFormat RenderFormat = "text/extended" // ApplicationJSONFormat renders as indented JSON ApplicationJSONFormat RenderFormat = "application/json" // ApplicationCloudEventV1Format renders as a ApplicationCloudEventV1Format v1 ApplicationCloudEventV1Format RenderFormat = "application/cloudeventv1" )
type ReplayPolicy ¶
type ReplayPolicy int
const ( ReplayInstant ReplayPolicy = iota ReplayOriginal )
func (ReplayPolicy) MarshalJSON ¶
func (p ReplayPolicy) MarshalJSON() ([]byte, error)
func (ReplayPolicy) MarshalYAML ¶ added in v0.2.0
func (p ReplayPolicy) MarshalYAML() (any, error)
func (ReplayPolicy) String ¶
func (p ReplayPolicy) String() string
func (*ReplayPolicy) UnmarshalJSON ¶
func (p *ReplayPolicy) UnmarshalJSON(data []byte) error
func (*ReplayPolicy) UnmarshalYAML ¶ added in v0.2.0
func (p *ReplayPolicy) UnmarshalYAML(data *yaml.Node) error
type RetentionPolicy ¶
type RetentionPolicy int
const ( LimitsPolicy RetentionPolicy = iota InterestPolicy WorkQueuePolicy )
func (RetentionPolicy) MarshalJSON ¶
func (p RetentionPolicy) MarshalJSON() ([]byte, error)
func (RetentionPolicy) MarshalYAML ¶ added in v0.1.0
func (p RetentionPolicy) MarshalYAML() (any, error)
func (RetentionPolicy) String ¶
func (p RetentionPolicy) String() string
func (*RetentionPolicy) UnmarshalJSON ¶
func (p *RetentionPolicy) UnmarshalJSON(data []byte) error
func (*RetentionPolicy) UnmarshalYAML ¶ added in v0.1.0
func (p *RetentionPolicy) UnmarshalYAML(data *yaml.Node) error
type SchemaManagedApiRequestType ¶ added in v0.3.0
type SchemaManagedApiRequestType interface {
SchemaManagedType
ApiSubjectFormat() (string, error)
ApiSubjectPrefix() (string, error)
ApiSubjectPattern() (string, error)
}
SchemaManagedApiRequestType is a type that supports schema based introspection including API subjects
type SchemaManagedType ¶ added in v0.3.0
type SchemaManagedType interface {
SchemaType() string
SchemaID() string
Schema() ([]byte, error)
Validate(v ...StructValidator) (valid bool, errors []string)
}
SchemaManagedType is a type that supports schema based introspection
type SequenceInfo ¶ added in v0.0.26
type SequenceInfo struct {
Consumer uint64 `json:"consumer_seq"`
Stream uint64 `json:"stream_seq"`
Last *time.Time `json:"last_active,omitempty"`
}
SequenceInfo is the consumer and stream sequence that uniquely identify a message
type StorageType ¶
type StorageType int
const ( FileStorage StorageType = iota MemoryStorage )
func (StorageType) MarshalJSON ¶
func (t StorageType) MarshalJSON() ([]byte, error)
func (StorageType) MarshalYAML ¶ added in v0.1.0
func (t StorageType) MarshalYAML() (any, error)
func (StorageType) String ¶
func (t StorageType) String() string
func (*StorageType) UnmarshalJSON ¶
func (t *StorageType) UnmarshalJSON(data []byte) error
func (*StorageType) UnmarshalYAML ¶ added in v0.1.0
func (t *StorageType) UnmarshalYAML(data *yaml.Node) error
type StreamAlternate ¶ added in v0.0.31
type StreamConfig ¶
type StreamConfig struct {
// A unique name for the string, cannot contain dots, spaces or wildcard characters
Name string `json:"name" yaml:"name"`
Description string `json:"description,omitempty" yaml:"description"`
Subjects []string `json:"subjects,omitempty" yaml:"subjects"`
Retention RetentionPolicy `json:"retention" yaml:"retention"`
MaxConsumers int `json:"max_consumers" yaml:"max_consumers"`
MaxMsgsPer int64 `json:"max_msgs_per_subject" yaml:"max_msgs_per_subject"`
MaxMsgs int64 `json:"max_msgs" yaml:"max_msgs"`
MaxBytes int64 `json:"max_bytes" yaml:"max_bytes"`
MaxAge time.Duration `json:"max_age" yaml:"max_age"`
MaxMsgSize int32 `json:"max_msg_size,omitempty" yaml:"max_msg_size"`
Storage StorageType `json:"storage" yaml:"storage"`
Discard DiscardPolicy `json:"discard" yaml:"discard"`
Replicas int `json:"num_replicas" yaml:"num_replicas"`
NoAck bool `json:"no_ack,omitempty" yaml:"no_ack"`
Template string `json:"template_owner,omitempty" yaml:"-"`
Duplicates time.Duration `json:"duplicate_window,omitempty" yaml:"duplicate_window"`
Placement *Placement `json:"placement,omitempty" yaml:"placement"`
Mirror *StreamSource `json:"mirror,omitempty" yaml:"mirror"`
Sources []*StreamSource `json:"sources,omitempty" yaml:"sources"`
Compression Compression `json:"compression,omitempty" yaml:"compression"`
// Allow applying a subject transform to incoming messages before doing anything else
SubjectTransform *SubjectTransformConfig `json:"subject_transform,omitempty" yaml:"subject_transform"`
// Allow republish of the message after being sequenced and stored.
RePublish *RePublish `json:"republish,omitempty" yaml:"republish"`
// Sealed will seal a stream so no messages can get out or in.
Sealed bool `json:"sealed" yaml:"sealed"`
// DenyDelete will restrict the ability to delete messages.
DenyDelete bool `json:"deny_delete" yaml:"deny_delete"`
// DenyPurge will restrict the ability to purge messages.
DenyPurge bool `json:"deny_purge" yaml:"deny_purge"`
// AllowRollup allows messages to be placed into the system and purge
// all older messages using a special msg header.
RollupAllowed bool `json:"allow_rollup_hdrs" yaml:"allow_rollup_hdrs"`
// Allow higher performance, direct access to get individual messages.
AllowDirect bool `json:"allow_direct" yaml:"allow_direct"`
// Allow higher performance and unified direct access for mirrors as well.
MirrorDirect bool `json:"mirror_direct" yaml:"mirror_direct"`
// Allow KV like semantics to also discard new on a per subject basis
DiscardNewPer bool `json:"discard_new_per_subject,omitempty" yaml:"discard_new_per_subject"`
// FirstSeq sets a custom starting position for the stream
FirstSeq uint64 `json:"first_seq,omitempty" yaml:"first_seq"`
// Metadata is additional metadata for the Consumer.
Metadata map[string]string `json:"metadata,omitempty" yaml:"metadata"`
// AllowMsgTTL allows header initiated per-message TTLs. If disabled,
// then the `NATS-TTL` header will be ignored.
AllowMsgTTL bool `json:"allow_msg_ttl,omitempty" yaml:"allow_msg_ttl" api_level:"1"`
// SubjectDeleteMarkerTTL enables and sets a duration for adding server markers for delete, purge and max age limits
SubjectDeleteMarkerTTL time.Duration `json:"subject_delete_marker_ttl,omitempty" yaml:"subject_delete_marker_ttl" api_level:"1"`
// The following defaults will apply to consumers when created against
// this stream, unless overridden manually. They also represent the maximum values that
// these properties may have
ConsumerLimits StreamConsumerLimits `json:"consumer_limits" yaml:"consumer_limits"`
// AllowAtomicPublish allows atomic batch publishing into the stream.
AllowAtomicPublish bool `json:"allow_atomic,omitempty" yaml:"allow_atomic" api_level:"2"`
// AllowMsgCounter allows a stream to use (only) counter CRDTs.
AllowMsgCounter bool `json:"allow_msg_counter,omitempty" yaml:"allow_msg_counter" api_level:"2"`
// AllowMsgSchedules allows the scheduling of messages.
AllowMsgSchedules bool `json:"allow_msg_schedules,omitempty" yaml:"allow_msg_schedules" api_level:"2"`
// PersistMode allows to opt-in to different persistence mode settings.
PersistMode PersistModeType `json:"persist_mode,omitempty" yaml:"persist_mode" api_level:"2"`
}
StreamConfig is the configuration for a JetStream Stream Template
NATS Schema Type io.nats.jetstream.api.v1.stream_configuration
func (StreamConfig) Schema ¶
func (t StreamConfig) Schema() ([]byte, error)
Schema is a JSON Schema document for the JetStream Consumer Configuration
func (StreamConfig) SchemaID ¶
func (t StreamConfig) SchemaID() string
SchemaID is the url to the JSON Schema for JetStream Consumer Configuration
func (StreamConfig) SchemaType ¶
func (t StreamConfig) SchemaType() string
SchemaType is the NATS schema type io.nats.jetstream.api.v1.stream_configuration
func (StreamConfig) Validate ¶
func (t StreamConfig) Validate(v ...StructValidator) (valid bool, errors []string)
Validate performs a JSON Schema validation of the configuration
type StreamConsumerLimits ¶ added in v0.1.1
type StreamConsumerLimits struct {
InactiveThreshold time.Duration `json:"inactive_threshold,omitempty" yaml:"inactive_threshold"`
MaxAckPending int `json:"max_ack_pending,omitempty" yaml:"max_ack_pending"`
}
StreamConsumerLimits describes limits and defaults for consumers created on a stream
type StreamInfo ¶
type StreamInfo struct {
Config StreamConfig `json:"config" yaml:"config"`
Created time.Time `json:"created" yaml:"created"`
State StreamState `json:"state" yaml:"state"`
Cluster *ClusterInfo `json:"cluster,omitempty" yaml:"cluster"`
Mirror *StreamSourceInfo `json:"mirror,omitempty" yaml:"mirror"`
Sources []*StreamSourceInfo `json:"sources,omitempty" yaml:"sources"`
Alternates []StreamAlternate `json:"alternates,omitempty" yaml:"alternates"`
TimeStamp time.Time `json:"ts" yaml:"ts"`
}
type StreamSource ¶ added in v0.0.21
type StreamSource struct {
Name string `json:"name" yaml:"name"`
OptStartSeq uint64 `json:"opt_start_seq,omitempty" yaml:"opt_start_seq"`
OptStartTime *time.Time `json:"opt_start_time,omitempty" yaml:"opt_start_time"`
FilterSubject string `json:"filter_subject,omitempty" yaml:"filter_subject"`
External *ExternalStream `json:"external,omitempty" yaml:"external"`
SubjectTransforms []SubjectTransformConfig `json:"subject_transforms,omitempty" yaml:"subject_transforms"`
}
StreamSource dictates how streams can source from other streams.
type StreamSourceInfo ¶ added in v0.0.21
type StreamSourceInfo struct {
Name string `json:"name" yaml:"name"`
External *ExternalStream `json:"external,omitempty" yaml:"external"`
Lag uint64 `json:"lag" yaml:"lag"`
Active time.Duration `json:"active" yaml:"active"`
Error *ApiError `json:"error,omitempty" yaml:"error"`
FilterSubject string `json:"filter_subject,omitempty" yaml:"filter_subject"`
SubjectTransforms []SubjectTransformConfig `json:"subject_transforms,omitempty" yaml:"subject_transforms"`
}
StreamSourceInfo shows information about an upstream stream source.
type StreamState ¶
type StreamState struct {
Msgs uint64 `json:"messages" yaml:"messages"`
Bytes uint64 `json:"bytes" yaml:"bytes"`
FirstSeq uint64 `json:"first_seq" yaml:"first_seq"`
FirstTime time.Time `json:"first_ts" yaml:"first_ts"`
LastSeq uint64 `json:"last_seq" yaml:"last_seq"`
LastTime time.Time `json:"last_ts" yaml:"last_ts"`
NumDeleted int `json:"num_deleted,omitempty" yaml:"num_deleted"`
Deleted []uint64 `json:"deleted,omitempty" yaml:"deleted"`
NumSubjects int `json:"num_subjects,omitempty" yaml:"num_subjects"`
Subjects map[string]uint64 `json:"subjects,omitempty" yaml:"subjects"`
Lost *LostStreamData `json:"lost,omitempty" yaml:"lost"`
Consumers int `json:"consumer_count" yaml:"consumer_count"`
}
type StructValidator ¶ added in v0.0.19
type StructValidator interface {
ValidateStruct(data any, schemaType string) (ok bool, errs []string)
}
StructValidator is used to validate API structures
type SubjectTransformConfig ¶ added in v0.1.0
type SubjectTransformConfig struct {
Source string `json:"src" yaml:"src"`
Destination string `json:"dest" yaml:"dest"`
}
SubjectTransformConfig is for applying a subject transform (to matching messages) before doing anything else when a new message is received
type UnknownMessage ¶
UnknownMessage is a type returned when parsing an unknown type of event