Sounds like you want to defer a message ?
Don't know much about the Azure SDK for Node.js but from the MSDN Documentation you can set a ScheduledEnqueueTimeUtc on the message :
The scheduled enqueue time in UTC. This value is for delayed message sending. It is utilized to delay messages sending to a specific time in the future.
Only sample to send a message to a Queue is :
var message = {
body: 'Test message',
customProperties: {
testproperty: 'TestValue'
}};
serviceBusService.sendQueueMessage('myqueue', message, function(error){
if(!error){
// message sent
}
});
From the nodejs sdk, I found a constants.js file that defines these properties :
/**
* The broker properties for service bus queue messages.
*
* @const
* @type {string}
*/
BROKER_PROPERTIES_HEADER: 'brokerproperties',
...
/**
* The scheduled enqueue time header.
*
* @const
* @type {string}
*/
SCHEDULED_ENQUEUE_TIME_HEADER: 'x-ms-scheduled-enqueue-time',
If you have a look at the servicebusservice.js, there is a setRequestHeaders function that takes some properties of the message and set it as header.
So I guess you can set this property on the message like that :
// Set your scheduled date
var scheduledDate = Date.now();
scheduledDate.setHours(scheduledDate.getHours()+3);
var message = {
body: 'Test message',
brokerproperties: {
'x-ms-scheduled-enqueue-time': scheduledDate.toUTCString()
}};
Let me know if it works :-)