-
Notifications
You must be signed in to change notification settings - Fork 0
GetQueueMethod
Michael J. Ryan edited this page May 21, 2015
·
1 revision
The azure-config-util object instance presents a queue(name) method that returns a promise, that will resolve to an azure-storage-simple queue instance.
This method uses storage(...) to establish an azure-storage-simple connection wrapper.
| Section | Key | JsonValue |
|---|---|---|
| queue | somequeue | {"storage":"account", "name": "somequeuename"} |
- The shown
"name"field in theJsonValueis optional when it matches theKey.
-
storage- specifies the named storage account to use (see storage(...)) -
name- the name of the blob container to create/use (will call createQueueIfNotExists once)
// when there's no matching Key, or no "storage" is specified
// under the covers: azureUtil.storage().queue('randomq');
let unspecifiedQ = await azureUtil.queue('randomq');
// when there is a matching key
// under the covers: azureUtil.storage('account').blob('somequeuename');
let q = await azureUtil.queue('somequeue');
//child methods will call createQueueIfNotExist under the covers (once)
await queue.add(value);
var message = await q.one(); //gets a message
// message is wrapped with:
// .value - parsed value
// other properties are buried in the prototype chain
var value2 = message.value; //unwrap the value
// got message/value - 30 seconds to resolve it
await q.done(message); //mark as complete / resolve / remove from queue