-2

I am trying to use Microsoft Azure Queue to replace the Thread with a Queue in my progruma, I currently use the Thread to perform some functions, and I would like instead to use those Azure Queue to be able to manage and execute such functions, but studying a little The tool has seen that the CloudQueueMessage can only contain a String or a Byte [], someone knows if there would be a way to use Queue to perform these functions.

I'm currently using my Thread Like.

Thread thread = new Thread(new System.Threading.ThreadStart(timer.StartTimer));
thread.Name = "IdTipoConsulta=" + Convert.ToString(entityTipoConsulta.IdTipoConsulta) +
              ";" + entityTipoConsulta.Nome +
              ";" + DateTime.Now.ToString() +
              ";" + Guid.NewGuid().ToString();
thread.Start();
listThread.Add(thread);

1 Answers1

1

A Queue doesn't do work for you. You use a Queue to asynchronously send messages to another application or service that will then be triggered to do the necessary processing in the background. The best services to use for implementing the background processing code that is triggered by messages in a Queue are Azure Functions and Azure Web Jobs.

Chris Pietschmann
  • 29,502
  • 35
  • 121
  • 166
  • Technically, you don't use a queue to send messages to another application or service. You can add messages to a queue, read messages from a queue, delete messages from a queue. In that way, you can have one process write to the queue and have a separate, automated process read from the queue, handle the message, and then delete it. As noted by Chris, this is frequently done from Azure Functions and Web Jobs. In the old days (2010), Cloud Services Worker Roles were used. – Robin Shahan - MSFT Mar 31 '17 at 21:22
  • @RobinShahan-MSFT Depends on they way you define the word "send" within the context. ;) – Chris Pietschmann Mar 31 '17 at 23:54