Skip to content
Michael J. Ryan edited this page May 21, 2015 · 1 revision

azureUtil.queue(name)

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.

Example

Table Values

Section Key JsonValue
queue somequeue {"storage":"account", "name": "somequeuename"}
  • The shown "name" field in the JsonValue is optional when it matches the Key.

JsonValue

Code

// 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

Clone this wiki locally