Barracuda Application Server C/C++ Reference
Native APIs, integration guides, and platform interfaces
SMQ Struct Reference

Detailed Description

SimpleMQ structure.

#include <SMQ.h>

Public Member Functions

 SMQ (U8 *buf, U16 bufLen)
 Create a SimpleMQ client instance. More...
 
int init (const char *url, U32 *rnd)
 Initiate the SMQ server connection. More...
 
int connect (const char *uid, int uidLen, const char *credentials, U8 credLen, const char *info, int infoLen)
 Connect/establish a persistent SimpleMQ connection. More...
 
void disconnect ()
 Gracefully close the connection. More...
 
 ~SMQ ()
 Terminate a SimpleMQ instance. More...
 
int create (const char *topic)
 Create a topic an fetch the topic ID (tid). More...
 
int createsub (const char *subtopic)
 Create a sub-topic and fetch the subtopic ID. More...
 
int subscribe (const char *topic)
 The response to SMQ_subscribe is asynchronous and returned as status SMQ_SUBACK via SMQ_getMessage. More...
 
int unsubscribe (U32 tid)
 Requests the broker to unsubscribe the server from a topic. More...
 
int publish (const void *data, int len, U32 tid, U32 subtid)
 Publish messages to a topic and optionally to a sub-topic. More...
 
int wrtstr (const char *str)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int write (const void *data, int len)
 Publish a message in chunks and request the broker to assemble the message before publishing to the subscriber(s). More...
 
int pubflush (U32 tid, U32 subtid)
 Flush the internal buffer and request the broker to assemble all stored fragments as one message. More...
 
int observe (U32 tid)
 Request the broker to provide change notification events when the number of subscribers to a specific topic changes. More...
 
int unobserve (U32 tid)
 Stop receiving change notifications for a topic ID or ephemeral topic ID. More...
 
int getMessage (U8 **msg)
 Wait for messages sent from the broker. More...
 
int getMsgSize ()
 Returns the message size, which is SMQ::frameLen - 15. More...
 

Public Attributes

U8 * buf
 The buffer set via the constructor. More...
 
U32 timeout
 Timeout in milliseconds to wait in functions waiting for server data. More...
 
U32 clientTid
 Client's unique topic ID. More...
 
U32 tid
 Topic: set when receiving MSG_PUBLISH from broker. More...
 
U32 ptid
 Publisher's tid: Set when receiving MSG_PUBLISH from broker. More...
 
U32 subtid
 Sub-tid: set when receiving MSG_PUBLISH from broker. More...
 
int status
 Last known error code. More...
 
U16 frameLen
 The SimpleMQ frame size for the incomming data. More...
 
U16 bytesRead
 Read frame data using SMQ_getMessage until: frameLen - bytesRead = 0. More...
 

Member Data Documentation

◆ buf

U8* SMQ::buf

The buffer set via the constructor.

◆ bytesRead

U16 SMQ::bytesRead

Read frame data using SMQ_getMessage until: frameLen - bytesRead = 0.

◆ clientTid

U32 SMQ::clientTid

Client's unique topic ID.

◆ frameLen

U16 SMQ::frameLen

The SimpleMQ frame size for the incomming data.

◆ ptid

U32 SMQ::ptid

Publisher's tid: Set when receiving MSG_PUBLISH from broker.

◆ status

int SMQ::status

Last known error code.

◆ subtid

U32 SMQ::subtid

Sub-tid: set when receiving MSG_PUBLISH from broker.

◆ tid

U32 SMQ::tid

Topic: set when receiving MSG_PUBLISH from broker.

◆ timeout

U32 SMQ::timeout

Timeout in milliseconds to wait in functions waiting for server data.