Download presentation
Presentation is loading. Please wait.
Published byMarvin Garrison Modified over 8 years ago
5
5 Worker Role Your Code
7
public class WorkerRole : RoleEntryPoint { public override void Run() { while (true) { Thread.Sleep(1000); //Do something here } public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; //Connection configuration CloudStorageAccount.SetConfigurationSettingPublisher((configName, configSetting) => { var connectionString = RoleEnvironment.GetConfigurationSettingValue(configName); configSetting(connectionString); }); return base.OnStart(); }
8
Creating a Simple Worker Role
11
//Create Queue CloudStorageAccount sa = CloudStorageAccount.FromConfigurationSetting("DataConnectionString"); private CloudQueueClient qc = sa.CreateCloudQueueClient(); private CloudQueue q = qc.GetQueueReference("incoming"); q.CreateIfNotExist(); //Add Message CloudQueueMessage m = new CloudQueueMessage(Message.Text); q.AddMessage(m); //Read Message CloudQueueMessage m = q.GetMessage();
12
TcpClient c = new TcpClient(); c.Connect("0.0.0.0", 4321); Stream s = c.GetStream(); StreamWriter sw = new StreamWriter(s); sw.WriteLine(data); sw.Flush();
14
Communicating with Worker Roles
17
Azure
18
Pluggable Services and Worker Roles
20
Call to Action For Download Download SharePoint VM http://www.microsoft.com/downloads/details.aspx?familyid=751FA0D1- 356C-4002-9C60-D539896C66CE&displaylang=en Download Azure Developer Center http://msdn.microsoft.com/en-us/azure/default.aspx Windows Azure SDK and Windows Azure Tools for Microsoft Visual Studio (November 2010) http://www.microsoft.com/downloads/en/details.aspx?FamilyID=7a1089b6- 4050-4307-86c4-9dadaa5ed018&displaylang=en For Reference Channel 9 SharePoint Developer Training Kit http://channel9.msdn.com/learn/courses/SharePoint2010Developer/ Channel 9 Azure Developer Training Kit http://channel9.msdn.com/learn/courses/Azure/
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.