0

We're writing a WCF service which will have to manage external client petitions, on those petitions we will:

  • Connect to another external service (not under our control) and validate a signature to ensure the identity of the caller.
  • Make several operations on our environment.
  • Finally, if everything is ok, call to another external service (again not under our control) and obtain a registry number to send to the client as a response.

From my point of view, the external services calls add too much entropy to allow all process in only one operation, there are lots of possible scenarios out of our reach that can finish with a timeout on the final client.

IMHO we should try to write different operations to manage each of the different parts (generating a secure token to carry authentication during 2nd and 3rd steps) so we can avoid an scenario where all the processes works fine but takes too much time and the client stops waiting for the response, generating a timeout.

My opinion is not shared for other members of the team, who wants to do all in a single operation.

Is there a best practice for this type of scenarios? Will be better to use different operations or won't it have impact at all?

Bardo
  • 2,470
  • 2
  • 24
  • 42
  • If it takes much time to complete this request, I would do it in two operations: make request, ask status. The final client should send a request and receive "Enqueued" status. Then, he will be able to ask for a status, not worrying about timeouts and not worrying about how much time does it take - 1 second, 5 seconds or 24 hours. At the same time, you should make your operations and update the actual status. – Yeldar Kurmangaliyev Dec 21 '15 at 08:28

1 Answers1

0

You can leverage of callback contract. Create oneway operation and let client invoke service and order all work to be done. Within method save client's reference and once all the long-running work is done, check if client's reference is not null so as to make sure client has not been closed. If not then invoce callback operation specified in callback contract. The pros of such as way out is that client does not keep waiting for the result but he is informed when result is obtained and ready to be provided. I refer you to this post.

Community
  • 1
  • 1
Maximus
  • 3,458
  • 3
  • 16
  • 27