Hi there folks,
Not the easiest topic to search in b4j forum "start a new thread" or "new thread"
Keep getting tons of "Place the question in a new thread" kind of answers 
I have the following situation:
I am receiving MQTT packets. Each packet is used for doing some calculations and processing and finally I store it into MYSQL. This needs to happen at the best possible speed (which currently is working fine).
But then, if a particular MQTT message arrives, I need to also perform a second processing over it. But I do not need to pause or slow the main "task" of calculation and processing.
I need this second processing to happen concurrently on a new thread. This second processing may need to send one or more MQTT messages, and also will be stored in yet another table, on mysql. So it WILL take some time. This is why I need it to happen separately. There will be no GUI output, it's all "internal" working.
In short, how can I call a sub making it start on a separate thread ? Is this possible at all ?
Regards,
Enrique
p.d. I understand that multithreading is not a good thing on B4J (unless working with the web server library) so any suggestions or alternatives are welcome!
Not the easiest topic to search in b4j forum "start a new thread" or "new thread"
I have the following situation:
I am receiving MQTT packets. Each packet is used for doing some calculations and processing and finally I store it into MYSQL. This needs to happen at the best possible speed (which currently is working fine).
But then, if a particular MQTT message arrives, I need to also perform a second processing over it. But I do not need to pause or slow the main "task" of calculation and processing.
I need this second processing to happen concurrently on a new thread. This second processing may need to send one or more MQTT messages, and also will be stored in yet another table, on mysql. So it WILL take some time. This is why I need it to happen separately. There will be no GUI output, it's all "internal" working.
In short, how can I call a sub making it start on a separate thread ? Is this possible at all ?
Regards,
Enrique
p.d. I understand that multithreading is not a good thing on B4J (unless working with the web server library) so any suggestions or alternatives are welcome!