I am trying to find what I am doing wrong with regard to the Azure WebJobs QueueTrigger method, which should start from the Azure storage queue.
I read several documents (as in msdn blogs / posts). But I still do not understand.
The main question / misunderstood aspect:
What should be the name of the connection string for the Azure Storage Console App.config application or Windows Azure Configuration (portal). So far I have the following name in both places.
- AzureJobsStorage
- AzureWebJobsStorage
- AzureJobsRuntime
- AzureJobsDashboard
- AzureJobsData li>
Here is my WebJobs console application code.
static void Main() { JobHost host = new JobHost(); host.RunAndBlock(); } public static void CreateLeague([QueueTrigger("temp")] string msg) { var task = JsonConvert.DeserializeObject<QueueTask>(msg); if (task.TaskType == QueueTask.TaskTypes.Pdf) RenderPdf(task.Id); }
This console application is constantly running on my Azure website.
I can access my debug page, where I can switch the output, and I can see that it is running / running.
My code for adding a queue (from my ASP.NET MVC application):
CloudStorageAccount storageAccount = CloudStorageAccount.Parse(ConfigurationManager.AppSettings["StorageConnectionString"]); CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQueue queue = queueClient.GetQueueReference("temp"); queue.CreateIfNotExists(); Common.QueueTask task = new Common.QueueTask(); task.TaskType = Common.QueueTask.TaskTypes.Pdf; task.Id = p.Id; CloudQueueMessage msg = new CloudQueueMessage(JsonConvert.SerializeObject(task) ); queue.AddMessage(msg);
This code executes and the queue is added to my vault account. But they did not get a "dequeue" or read from WebJobs.
source share