Class: RacQ

RacQ~ RacQ

new RacQ(optionsopt, options.userName, options.apiKey, options.regionopt, options.clientIdopt, options.persistedTokenPathopt)

Parameters:
Name Type Attributes Description
options Object <optional>
null, or an object containing the following properties:
Properties
Name Type Attributes Description
userName String Rackspace user name (specify here, or when calling authenticate)
apiKey String Rackspace API key (specify here, or when calling authenticate)
region String <optional>
Rackspace default region. Can be one of: iad, ord, dfw, hkg, lon, syd - defaults to dfw
clientId String <optional>
A GUID identifying the current queue client. Defaults to a random GUID
persistedTokenPath String <optional>
If provided, auth token will be persisted locally, and looked for at this path
Source:

Methods

authenticate(userNameopt, apiKeyopt, callback)

Authenticate API calls Authenticates credentials against Rackspace auth endpoint, receiveing the auth token used in the rest of the calls. If a path has been specified in constructor, token will be taken from local file, and received token will be persisted to local file.
Parameters:
Name Type Attributes Description
userName String <optional>
Rackspace user name (if not provided to constructor)
apiKey String <optional>
Rackspace user name (if not provided to constructor)
callback function the function to call when authentication ends. Returns with null on success, or error object
Source:

claimMessages(queueName, parametersopt, parameters.limitopt, parameters.ttlopt, parameters.graceopt, callback)

Claim messages: a client can mark messages it's handling with a claim, delete them upon process end, or releasing the claim if it takes too long to process
Parameters:
Name Type Attributes Description
queueName String
parameters Object <optional>
claim paramters:
Properties
Name Type Attributes Description
limit Integer <optional>
maximum number of messages to claim. Can be 1-20, default 10
ttl Integer <optional>
time before server releases the claim. Can be 60-43200 seconds (12 hours), default 60
grace Integer <optional>
grace period to extend claimed message's life. Can be 60-43200 seconds (12 hours), default 60
callback function Returns array of message objects on success, or error object
Source:

createQueue(queueName, callback)

Create new queue
Parameters:
Name Type Description
queueName String
callback function Returns with null on success, or error object
Source:

deleteMessages(queueName, messageIds, claimIdopt, callback)

Delete message from queue
Parameters:
Name Type Attributes Description
queueName String
messageIds String one or more message ids, separated by comma
claimId String <optional>
if provided, will provide the claim Id for a SINGLE message to be deleted
callback function Returns null on success, or error object
Source:

deleteQueue(queueName, callback)

Delete queue
Parameters:
Name Type Description
queueName String
callback function Returns with null on success, or error object
Source:

getClientId() → {String}

Get current client ID
Source:
Returns:
client ID GUID
Type
String

getMessages(queueName, parametersopt, parameters.limitopt, parameters.markeropt, parameters.echoopt, parameters.include_claimedopt, callback)

Get messages from queue Can be invoked with 2, 3 or 4 parameters: queueName, [echo], [limit], callback
Parameters:
Name Type Attributes Description
queueName String
parameters Object <optional>
query parameters. Can be null, or an object with one or more of the following:
Properties
Name Type Attributes Description
limit Integer <optional>
limit number of messages returned (1-10, default: 10)
marker Integer <optional>
The marker to use to get the next batch of messages
echo Boolean <optional>
should messages put by this client be returned (default: false)
include_claimed Boolean <optional>
should claimed messages be returned (default: false)
callback function Returns array of message objects on success, or error object
Source:

getMessagesById(queueName, messageIds, callback)

Get message/s by id/s
Parameters:
Name Type Description
queueName String
messageIds String one or more message ids, seperated by comma
callback function Returns array of message objects on success, or error object
Source:

getQueueMetadata(queueName, callback)

Get queue metadata
Parameters:
Name Type Description
queueName String
callback function Returns with queue metadata, or error object
Source:

getQueueStats(queueName, callback)

Get queue statistics
Parameters:
Name Type Description
queueName String
callback function Returns with stats, or error object
Source:

getStatistics() → {Object}

Get current network statistics (for accounting purposes)
Source:
Returns:
statistics object containing number of calls, bytes sent, and bytes recieved so far
Type
Object

listQueues(parametersopt, parameters.limitopt, parameters.markeropt, parameters.detailedopt, callback)

List all queues in account, in alphabetical order
Parameters:
Name Type Attributes Description
parameters Object <optional>
query parameters. Can be null, or an object with one or more of the following:
Properties
Name Type Attributes Description
limit Integer <optional>
limit number of queues returned (1-10, default: 10)
marker Integer <optional>
The marker to use to get the next batch of messages
detailed Boolean <optional>
should queue data include metadata (default: false)
callback function Returns with array of queues on success, or error object
Source:

postMessages(queueName, messages, messages.ttl, messages.body, callback)

Put message/s in queue
Parameters:
Name Type Description
queueName String
messages Object | Array Object, or Array of Objects, 1-10 messages in the following format:
Properties
Name Type Description
ttl Integer Time-To-Live for message in seconds (min. value 60)
body Object A JSON message object
callback function Returns null if successful, or error object
Source:

queryClaims(queueName, claimIds, callback)

Check which massages are claimed by claim ids
Parameters:
Name Type Description
queueName String
claimIds String one, or more claim ids to verify, separated by comma
callback function Returns array of message objects on success, or error object
Source:

queueExists(queueName, callback)

Checks whether a queue exists
Parameters:
Name Type Description
queueName String
callback function Returns with true if queue exists, false otherwise, or error object
Source:

releaseClaims(queueName, claimIds, callback)

Release claim on messages, allowing them to be claimed by a different client
Parameters:
Name Type Description
queueName String
claimIds String one, or more claim ids to verify, separated by comma
callback function Returns null on success, or error object
Source:

setQueueMetadata(queueName, metadata, callback)

Set queue metatdata
Parameters:
Name Type Description
queueName String
metadata Object
callback function Returns null on success, or error object
Source:

updateClaims(queueName, claimIds, parameters, parameters.ttl, parameters.grace, callback)

Update the TTL and grace period of claimed messages
Parameters:
Name Type Description
queueName String
claimIds String one, or more claim ids to verify, separated by comma
parameters Object
Properties
Name Type Description
ttl Integer time before server releases the claim. Can be 60-43200 seconds (12 hours), default 60
grace Integer grace period to extend claimed message's life. Can be 60-43200 seconds (12 hours), default 60
callback function Returns null on success, or error object
Source: