gmqnet

package
v0.0.0-...-df619d1 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CLUSTER_PROTO = "tcp"
	DEFAULT_CLUSTER_PORT  = "4812"
	DEFAULT_TIMEOUT_MSEC  = 4000
)

Variables

This section is empty.

Functions

func ClusterPeerDiscovery

func ClusterPeerDiscovery(params *gmqconf.Params) error

func GenSha512Token

func GenSha512Token(in string) string

func HandleConnection

func HandleConnection(server *gmqconf.Server, params *gmqconf.Params) (err error)

HandleConnection is a function configuring the server to accetp connections Params: the pointer to the Server singleton instantiedted by the provisioner, the server configuration parameters Returns: any error generated during the connection with clients

Every client connection is handled in a goroutine: the incoming message will be parsed and the operation executed

func WriteMessage

func WriteMessage(m *Message) []byte

Write a Message type into a byte array Params: the pointer to the Message type Returns: the JSON byte array

Types

type AuthToken

type AuthToken struct {
	UserTok string `json:"user"`
	PwdTok  string `json:"password"`
}

Authentication hashes to acces the server

type Message

type Message struct {
	Operation string    `json:"operation"`
	Queue     string    `json:"queue"`
	Payload   string    `json:"payload"`
	Confirmed string    `json:"confirmation"`
	Error     error     `json:"error"`
	Auth      AuthToken `json:"auth"`
}

Message is the type describing the information exchange between gmqserver and gmqclient

Operation: "P" (publish, post a message) or "S" (subscribe, retrieve a message) Queue: the queue name to be used Payload: in case Operation is "P", the base64 encoded message to be stored in the queue Confirmed: contains the result of submitted operation, can be "Y" or "N" Error: strin representation of the error, if none empty

func ParseMessage

func ParseMessage(in []byte) (*Message, error)

Parses a JSON byte array trying to convert it to a Message Params: the input byte array Returns: the pointer to the Mesage type, an error if parsing fails

Jump to

Keyboard shortcuts

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