public void AddAction()

in SmvLibrary/CloudSMVActionScheduler.cs [168:223]


        public void AddAction(SMVAction action, SMVActionCompleteCallBack callback, object context)
        {
            try
            {
                Log.LogDebug("Reached AddAction of cloud" + action.GetFullName());
                Log.LogDebug("Adding action " + action.GetFullName());
                string actionGuid = Guid.NewGuid().ToString();
                // Upload action directory to blob storage.

                string actionPath = Utility.GetActionDirectory(action);
                string zipPath = Path.Combine(Path.GetTempPath(), actionGuid);
                if (File.Exists(zipPath)) File.Delete(zipPath);
                ZipFile.CreateFromDirectory(actionPath, zipPath);
                Log.LogDebug("Created zip for " + actionPath);

                CloudBlockBlob blob = inputContainer.GetBlockBlobReference(actionGuid + ".zip");
                blob.UploadFromFile(zipPath);
                File.Delete(zipPath);
                Log.LogDebug("Uploaded blob " + blob.Name);

                // Add entry to table storage.

                // TODO: Due to constraints on sizes of properties in Azure table entities, serializedAction cannot be larger
                // than 64kB. Fix this if this becomes an issue.
                byte[] serializedAction = Utility.ObjectToByteArray(action);
                string moduleHash = string.Empty;
                ActionsTableEntry entry = new ActionsTableEntry(action.name, actionGuid, schedulerInstanceGuid, serializedAction,
                    Utility.version, null, moduleHash);
                tableDataSource.AddEntry(entry);

                Log.LogDebug("Added to table " + entry.PartitionKey + "," + entry.RowKey);
                CloudMessage cloudMessage = new CloudMessage();
                cloudMessage.schedulerInstanceGuid = schedulerInstanceGuid;
                cloudMessage.actionGuid = actionGuid;
                cloudMessage.maxDequeueCount = maxDequeueCount;
                cloudMessage.useDb = Utility.useDb;
                cloudMessage.taskId = Utility.taskId;

                string messageString = JsonConvert.SerializeObject(cloudMessage);
                // Add message to queue.        
                //Log.LogInfo("Executing: " + action.GetFullName() + " [cloud id:" + actionGuid + "]");
                //string messageString = schedulerInstanceGuid + "," + actionGuid + "," + maxDequeueCount;
                var message = new CloudQueueMessage(messageString);
                actionsQueue.AddMessage(message);

                Log.LogDebug("Adding to queue " + message.Id);

                contextDictionary[actionGuid] = new CloudActionCompleteContext(action, callback, context);

                Log.LogDebug("Done adding.");
            } catch(Exception e)
            {
                Utility.scheduler.Dispose();
                Log.LogFatalError(e.ToString());
            }
        }