Azure Queue, AddMessage then UpdateMessage -
is possible add message azure queue then, in same flow, update or delete message?
the idea use queue ensure work gets done - there's worker role monitoring queue. but, web role added message may able make progress toward (and complete) transaction.
the worker designed handle double-delivery , reprocessing partially handled messages (from previous, failed worker attempts) - there isn't technical problem here, time inefficiency , superfluous storage transactions.
so far seems adding message allows delivery delay, giving web role time, doesn't give pop-receipt seems we'd need update/delete message. missing something?
i suggest follow these steps worked me
how to: create queue cloudqueueclient object lets reference objects queues. following code creates cloudqueueclient object. code in guide uses storage connection string stored in azure application's service configuration. there other ways create cloudstorageaccount object. see cloudstorageaccount documentation details.
// retrieve storage account connection string cloudstorageaccount storageaccount = cloudstorageaccount.parse( cloudconfigurationmanager.getsetting("storageconnectionstring")); // create queue client cloudqueueclient queueclient = storageaccount.createcloudqueueclient();
use queueclient object reference queue want use. can create queue if doesn't exist.
// retrieve reference queue cloudqueue queue = queueclient.getqueuereference("myqueue"); // create queue if doesn't exist queue.createifnotexists();
how to: insert message queue insert message existing queue, first create new cloudqueuemessage. next, call addmessage method. cloudqueuemessage can created either string (in utf-8 format) or byte array. here code creates queue (if doesn't exist) , inserts message 'hello, world': // retrieve storage account connection string. cloudstorageaccount storageaccount = cloudstorageaccount.parse( cloudconfigurationmanager.getsetting("storageconnectionstring"));
// create queue client. cloudqueueclient queueclient = storageaccount.createcloudqueueclient(); // retrieve reference queue. cloudqueue queue = queueclient.getqueuereference("myqueue"); // create queue if doesn't exist. queue.createifnotexists(); // create message , add queue. cloudqueuemessage message = new cloudqueuemessage("hello, world"); queue.addmessage(message);
for more details, refer link. http://azure.microsoft.com/en-us/documentation/articles/storage-dotnet-how-to-use-queues/
girish prajwal
Comments
Post a Comment