Home Help Center

Proxy Endpoints ( Primary, Secondary )

vishreddykvishreddyk Member Vishwanath KasarlaOrganization: BarclaysProject: Risk System
Hi there,

We have the vanilla version of Ice running, got the requests from the client being sent to the server and responses from the server are being handled on the client side. No issues.

Now we have been asked to handle of couple of issues:

1) If the server were to go down, how can the client(s) be notified of this, so that the we can freeze the UI.

2) If we were to provide 2 proxy endpoints for the client, how can we make one as primary and the other as secondary. So when we detect the primary server is down, we want to switch it to the secondary server.

3) When a Client sends a request with this signature, is it considered to be "Oneway Invocation"?
Reponse SendRequest(Request)

Regards,
Vishwa

Comments

  • vishreddykvishreddyk Member Vishwanath KasarlaOrganization: BarclaysProject: Risk System
    After doing some research and working on samples: this is what I discovered:

    I have modified the client configuration to:
    Greet.Proxy=greet:tcp -h localhost -p 10000:tcp -h localhost -p 10001
    Greet.Proxy.EndpointSelection=Ordered

    And I ran 2 instances of severs with endpoints mentioned earlier.

    When the client sends a request, it goes to port 10000 ( as expected ).

    When I terminated server pointing to port 10000, the next request from the client went to the server (port: 100001).

    Ice runtime is aware that the server1 is down and requests have to sent to 2nd endpoint. cool!

    That answer my 2nd question.

    Now coming to my 3rd question, the answer is No, it is not oneway invocation.
    Console.WriteLine("Is Oneway Proxy: " + greet.ice_isOneway());
  • vishreddykvishreddyk Member Vishwanath KasarlaOrganization: BarclaysProject: Risk System
    Question:

    The client has 2 endpoints (OrderedSelection) and the both servers are running, if the first server is bombarded with requests (and the server is unable to cope-up with this), given this will the ice runtime route the requests to the 2nd server?
  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

    An oneway operation is an operation whose return type is "void" and doesn't have out parameters, see here in the Ice manual for a detailed description. Note that oneway invocations shouldn't be confused with oneway proxies.

    A oneway proxy is a proxy which is configured to send invocations as oneway and it will only accept sending oneway operations (trying to send a twoway operation on a oneway proxy will raise Ice::TwowayOnlyException). For example consider the following Slice oneway operation:
    // Slice
    interface Hello
    {
        void sayHello(int delay);
    };
    

    It can either be sent with a twoway or oneway proxy:
    // C++
    HelloPrx hello = ...
    
    // Send the sayHello oneway operation as twoway
    hello->ice_twoway()->sayHello(10);
    
    // Send the sayHello oneway operation as oneway
    hello->ice_oneway()->sayHello(10);
    

    In the case of the twoway invocation, the Ice runtime will wait for the reply and the call will only return once the reply is received. When sent as oneway, no reply will be sent and the call will return as soon as the invocation is sent.

    To answer your first question, there's no notification mechanism to figure out when a server goes down. We recommend using the session pattern to monitor the health of your server and find out when it's un-reachable. Basically, the GUI creates a session with the server and regularly pings the session to ensure it's still alive. If a ping fails, the GUI can take appropriate action to notify the user. See the session demo from your Ice demo distribution for an example of the session pattern (in the Ice/session directory for your favorite language mapping).

    Regarding your last question, yes if the first server for some reasons can't accept the connection from a client, the client will automatically try connecting to the second endpoint.

    Cheers,
    Benoit.
Sign In or Register to comment.