I’ve used very much the (Multi)Producer-Queue-Cosumer Design pattern, but I’ve no idea on how get the result of an operation.
I’ve 3 producer P1, P2, P3, that produce a message IMessage; this message is sent in a syncronized queue and elaborated from the Cosumer.
How can the consumer C tell to the producer (P1 or P2 or P3) that the request is finished and give the result?
One async way is for the consumer/s to queue the message back to its producer after completion. The message can contain result members, (and/or any exception object or error message that may have been raised during the message processing). Another possibility is that the producer simply waits on some sychro object that is also queued up with the message. The consumer signals it when done. Both these schemes ccould be supported by the producer loading up the message with an ‘OnCompletion(Message *thisMessage)’ function/event/delegate that the consumer calls when it has processed a message.