Respond in WCF web role after other roles complete
-
30-07-2022 - |
Question
I have a WCF service with public REST and SOAP endpoints that has a single post method. Currently the app processes as follows
- Object Posted to service method
- Service method passes data to storage queue then sends an XML response.
- Second worker role checks queue, does some processing and depending on processing, adds record to DB or rejects it.
My problem currently is that the WCF method responds before a decision is made to accept or reject the message. There is a lot of processing, and various worker roles are used after the WCF message is received depending on customer settings. I would like to be able to make the accept/reject decision and then respond with relevant data. I am wondering how to do this.
I could do an asynchronous Service method, but then all code would need to go into the WCF role or callable library which isn't ideal. Is there a way to not to the async End method until there is a response from another worker role (a message is in the queue)? I realize I could just do a thread.sleep and check the queue periodically, but then I would have to add the original request data to the queue and I really don't think that's the correct way to do things. I Googled this and couldn't find a concrete, non-hackish method.
Let me know if code samples would help, but (I think) it's pretty straightforward.
No correct solution