3 Replies Latest reply: Feb 12, 2013 6:18 AM by user123799 RSS

    Extend Client - Auto discovery and re-connection

      Couple of questions on version 3.7.1 of coherence, we have a scenario where a client is configured with only one proxy server address (let us say A), but we have more than one proxies (B, C and D) running in the cluster (four proxies and 4 cache nodes).

      We were assuming that when proxy A goes down, the re-connection happens only on a subsequent operation(put or get)? Is this True?
      What about the cache listeners or CQC, if they were registered originally on A? Should they be manually re-registered based on the member left event (when A goes away)?

      Thanks in advance.
        • 1. Re: Extend Client - Auto discovery and re-connection

          We use and have extend clients that use CQCs

          What we found was that if a connection to a proxy is lost, you have to manually refresh any CQCs that you have set up (when a reconnection happens).

          This does not happen magically, you have to deal with this case yourself.

          The way to detect when you've lost a connection to the proxy from the client is by registering a "Member Listener" on the client, for example...

          public class MyClass implements MemberListener {
               public void memberJoined(MemberEvent event) {
          // Called when a connection has been (re-)established

               public void memberLeaving(MemberEvent event) {
          // Called when proxy is shutting down

               public void memberLeft(MemberEvent event) {
          // Called when connection is lost

          In our application, if we get a "Member Left" event, we start to return "Service Unavailable" HTTP status codes (this takes the node out of our load balancer - if all our nodes lose the connection, then we are in trouble!!)

          We then try and refresh each NamedCache and CQC (by recreating them). When we manage to do this without an error, then we can assume that the connection is OK again and we start processing requests as usual.

          Not sure if there is any other way of doing this!

          Hope this helps...
          • 2. Re: Extend Client - Auto discovery and re-connection
            Thanks for the reply, yes, that's been our observation too.

            However, we were trying to test if specifying only one proxy IP in our cache-config xml on the client side, when we have a total of 4 available, and kill the specified proxy and see what happens.

            We were expecting the client to connect to the remaining proxies on a subsequent "get/put", it worked, but when we captured the member left event and re-registered our map listeners, the events were coming fine, but they were throwing errors everytime they receive an update/insert event, not sure why the exceptions were being logged, despite everything working otherwise.

            We were wondering if this is the expected behavior, or are we missing something?
            • 3. Re: Extend Client - Auto discovery and re-connection
              Hi user,

              Can you give more details of the exceptions you are seeing? A full coherence log may help clarify things...