msc

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: Apache-2.0 Imports: 7 Imported by: 2

README

Message services client

Package msc provides client for KrossIAM message services.

Documentation

Index

Constants

View Source
const (
	SubjectAction = "kiam.console.action"
	SubjectNotice = "kiam.console.notice"
	SubjectAudit  = "kiam.console.audit"
	SubjectLog    = "kiam.console.log"
)
View Source
const (
	ReplyOk         = 0   // ok
	ReplyError      = 1   // general error
	ReplyNoReply    = 100 // no reply(inbox) subject present
	ReplyBadVersion = 101 // version incompatibled
	ReplyBadTime    = 102 // time incorrent
	ReplyNoReqid    = 103 // missing reqid
	ReplyNoAction   = 104 // missing action
	ReplyNotImp     = 105 // not implemented
)

reply code

View Source
const Version = "0.1.1"

semantic versioning, https://semver.org

Variables

View Source
var Logger = logrus.StandardLogger().WithField("realm", "ms")

The default Logger has no any configuration(like log to file...), app should replace it with SetLogger()

Functions

func Borker added in v0.1.0

func Borker() *natsBroker

Return broker

func Connect

func Connect(servers []string)

Connect to message broker

func Disconnect added in v0.0.2

func Disconnect()

Disconnect from message broker

func MaxPayloadSize added in v0.0.3

func MaxPayloadSize() int64

MaxPayloadSize return maximum allowed payload size.

func SetLogger added in v0.0.3

func SetLogger(e *logrus.Entry)

Replace the default logger with customized logger

Types

type Reply added in v0.0.3

type Reply struct {
	Version string      `json:"version"` // protocol version
	Time    int64       `json:"time"`    // response timestamp, in microsecond
	ReqId   string      `json:"reqid"`   // request id, unique
	Code    int32       `json:"code"`    // response code
	Message string      `json:"message"` // response message
	Payload interface{} `json:"payload"` // payload
}

reply data

func MakeReply added in v0.0.3

func MakeReply(code int32, message string, payload interface{}, reqid string) *Reply

make a reply package

type Request added in v0.0.3

type Request struct {
	Version string      `json:"version"` // protocol version
	Time    int64       `json:"time"`    // request timestamp, in microsecond
	ReqId   string      `json:"reqid"`   // request id, unique
	Payload interface{} `json:"payload"` // payload
}

request data

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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