I have following ProcessQueueMessage function that gathers messages from service bus queue:
public static void ProcessQueueMessage([ServiceBusTrigger("dsique2")] BrokeredMessage message,
TextWriter logger)
{
logger.WriteLine($"Processing message: {message}");
Stream stream = message.GetBody<Stream>();
StreamReader reader = new StreamReader(stream);
string s = reader.ReadToEnd();
//Parse json
string output = s.Substring(s.IndexOf('{') , s.IndexOf('}') - s.IndexOf('{') + 1);
var json = JsonConvert.DeserializeObject<dynamic>(output);
var TS = Convert.ToDouble(json.ts);
var Speed = Convert.ToDouble(json.speed);
var Ped = Convert.ToDouble(json.ped);
var BrakePed = Convert.ToDouble(json.brakeped);
var lateralAcc1 = Convert.ToDouble(json.lateralacc1);
var steeringAngle = Convert.ToDouble(json.steeringangle);
//sends parsed values to function
Program.receive_emulate(0x415, Speed, TS, "offlineSpeed");
Program.receive_emulate(0x204, BrakePed , TS, "BrakePed ");
Program.receive_emulate(0x7D, lateralAcc1 , TS, "lateralAcc1 ");
Program.receive_emulate(0x92, steeringAngle , TS, "steeringAngle ");
}
So basically, whenever data comes from service bus queue as json format, I parse the json, get values and sent each signals to receive_emulate function. The problem is that the function is triggered before the data processing in receive_emulate function ends. What I want to do is, process single message, send them to receive_emulate functions. When function returns, take the second message in the queue. Unfortunately I could not achive this, any ideas would be deeply appreciated. Another even though it is written that Fifo is guaranteed in service bus queues in azure documentation, I notice that my messages are not coming in order. Is there any way to get them in ordered form? Many thanks