Documentation ¶
Index ¶
Constants ¶
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 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 ¶
Write a Message type into a byte array Params: the pointer to the Message type Returns: the JSON byte array
Types ¶
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 ¶
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