Bulb Flash:- Azure Message Queues-Passing objects

Azure queue takes either an array of bytes or a string as an input. While working on a web role- worker role interaction , i needed to pass the entire TableServiceEntity object(basically the Azure table datamodel) to the worker role.

I needed the partition key, the row key as well as some other attributes of the database entity in the worker role to do some processing…the best way out was XML Serialization!!

//serialize the tableserviceentity object in your webrole

Suppose your TableServiceEntity class is called XYZDataModel

//Deserialize it in your worker role

And now you have your XYZDataModel entity recreated in your worker role!!..Hope this helps you..We certainly will try to remember this piece of code!!

Thanks

Cennest

Advertisements