so far I have tried many different tutorials to get this to work but so far I have not been able to achieve this.
Currently I have a nodejs app that sends messages to the Service Bus Queue and another nodejs that polls continuously. My goal is to send a message to the queue with a specific time and date on which the polling system can process the message.
My results so far is that as soon as I send the message, it becomes visible and it is processed right away, here is what I have
//made some changes after the first suggestion, but still does not work
//what I'm doing here is offsetting the time difference with UTC(im in GMT-7 tz) by adding it manually
//(this is just a test so if this would have worked I would have made it more elegant)
var scheduled_time = new Date().valueOf() + ((60000*60)*7.5);
var current_time = Date.now();
console.log(scheduled_time, current_time);
var message = {
body: 'Time ' + current_time.toString(),
brokerProperties:{
ScheduledEnqueueTimeUtc: scheduled_time,
TimeToLive: 8
},
customProperties: {
testproperty: 'TestValue'
}};
serviceBus.sendQueueMessage('myqueue', message, function(error){
if(!error){
// message sent
console.log('message sent');
}
});
My receiver is very simple
function receiveMessages() {
serviceBus.receiveQueueMessage(queue,
function (error, message) {
if (error) {
console.log(error);
} else {
console.log('Process after ' + message.brokerProperties.ScheduledEnqueueTimeUtc);
}
});
};
so far I have read the GitHub page with the description of the properties of the message and it seems correct to what I have but it still does not work.
Thank you