locked
Client determination if WCF service is active RRS feed

  • Question

  • I'm writing a complex network of agents reporting to a central 'mother server'.  It is important that all clients know when 'mother' is down as well as when it comes back up as data is forwarded to Mother for trend analysis.

    So what is the best way for the client to interrogate an endpoint to determine if it is active or not?  Each agent runs a service that talks to a local WCF server.  The WCF server then deals with talking to the central WCF server.  All is written in C#, VS2010, WCF http services.

    I imagine once I sense Mother is down I'll start a thread that will keep watching until mother is up, then forward all missed transactions once it is back up.

     

    Guidance is appreciated.

    Thursday, June 10, 2010 4:42 PM

Answers

All replies

  • The only way to check if an endpoint is available is to try and consume one of its operations. So if I got you right, you have a local component that manages all the agents and communicates with the central component. One solution would be to buffer all the data sent from agents in the local component and try to resend the data to the central component every once and a while. That way, your agents don't need to handle communication problems and you centralize the handling logic by encapsulating it in one place.

    From the implementation aspect, you need two things: a timer and a buffer. If the local component doesn't succeed in sending the data (provided by some agent) to the central component, add data to a buffer. By using a Timer object with properly set interval, check (on firing of the Timer.Elapsed event) is the buffer element count greater than 0 and retry sending the data if it is. Once you succeed in sending, just remove the sent data from the buffer.

    One other thing, you should use async communication in order to keep the sending thread unblocked.

    So, did this help in any way? :)

     

    Regards,

    Stipe Ivan

    Thursday, June 10, 2010 9:14 PM
  • Hi

    What about Message queuing?Is that an option for you? Just go through the below article that illustrates queuing of messages untilt he server come up. http://www.codeproject.com/KB/aspnet/WCFPart2.aspx


    Please mark the response as answers if it solves your question or vote as helpful if you find it helpful. http://thoughtorientedarchitecture.blogspot.com/
    Friday, June 11, 2010 3:36 AM
  • The only way to know if the "service" "exists" is to call it.

    To this purpose, many services include a "Ping" operation (or perhaps a "GetServerInformation" operation) that, when called, does little or nothing, other than prove the the service exists

    Check out this as well.

    http://stackoverflow.com/questions/881754/how-to-check-the-availability-of-a-net-tcp-wcf-service

    Saturday, June 12, 2010 5:30 AM
  • OK.  The last post pointed me to a thread that eventually had a response regarding the fact that WCF 4.0 contains what I need to determine if the service is active or not.

     

    Thanks for your replies.

    Monday, June 14, 2010 7:11 PM