I have a working Azure role that has three types of processes:
- C # thread that reads from the database and writes to the input work queue (Task1)
- A Java thread that reads from worker-input-queue runs and writes to worker-output-queue
- C # stream, which reads from the work queue-output and writes to the database (Task2)
Task1 and Task2 work indefinitely and sleep if their respective queues are empty.
My code is as follows:
SpawnJavaProcesses(); Task.Factory.StartNew(Task1); Task.Factory.StartNew(Task2); while(true) { //do some trivial sporadic work Thread.Sleep(60*1000); }
My questions:
- Should I use the LongRunning task creation option when starting Task1 and Task2?
- Is there a better way to implement what I'm trying to do here?
Gilad source share