Some background information. This is a distributed application with multiples nodes. A 'communication' thread sends and receives all messages sent between these nodes. This cannot be changed.
A 'doStuff' thread asks the 'communication' thread to send a message to a node. It then needs to wait for a response from the other node. The 'communication' thread will receive this response message. It then needs to deliver this message to the correct 'doStuff' thread.
I am unsure what sort of information needs to be stored at the node or within the message to ensure that the correct thread always receives the response message.
Looking for some advice upon how to achieve this. Thanks for reading :)