I have a load balanced service that needs two data inputs to correctly give a result.
One of these inputs comes from a queue, the other comes from user input.
Most of the time the data that comes from the queue arrives long before the user input. This data from the queue is saved to a database and when the user input arrives it is used to create the result.
But about 10% of the time the user input happens first. When that happens I need to wait (meaning block the process) for the queue data to arrive prior to giving a response to the user.
The problem with the 10% scenario is knowing when the queue data has arrived so I can continue. I could keep querying the database, asking "are you there?", "are you there now?", "How about now?" But I don't like that for many reasons.
(I also considered using process to process communication, but that does not work because my service is load balanced.)
Is there some way that other applications deal with this kind of thing? Something that does not have me pinging the database asking over and over till the data is there?