Advice on reconnecting hazelcast client

404 views
Skip to first unread message

Bob Meyer

unread,
Oct 20, 2014, 4:06:38 PM10/20/14
to haze...@googlegroups.com

  We are using Hazelcast as shared memory on a high traffic web application. It is critical that http requests continue to be  responded to quickly (about 100 ms) even if the connection between the Hazelcast client and server is disconnected. For this reason we cannot set the connection retry limit in the client config to be non zero (because then our application will not respond to requests in time). However, we do want to have a separate mechanism to check if a reconnection can be made, and to reconnect the client when available. What is the best practice for doing this?

Currently, I have a lifecycle listener configured in the client config, and I when I get the CLIENT_DISCONNECTED message, I know I need to reconnect, but I don't know how.

My application holds a HazelcastInstance object reference to the client.  Do I need to create a new HazelcastInstance with:

 hzInstance = HazelcastClient.newHazelcastClient(hzClientConfig);

or is there some way to reconnect the existing client? What is the best practice to reconnect the client in this situation?

Thanks,
 Bob

M. Sancar Koyunlu

unread,
Oct 22, 2014, 7:39:55 AM10/22/14
to haze...@googlegroups.com
It will try to reconnect according to your client network configuration. 


If it cannot connect after that it will shutdown itself. You can see that with SHUTDOWN form  lifecycle listener. After that you have to create another client. But you should not need that if you configure network configurations accordingly. 

--
You received this message because you are subscribed to the Google Groups "Hazelcast" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hazelcast+...@googlegroups.com.
To post to this group, send email to haze...@googlegroups.com.
Visit this group at http://groups.google.com/group/hazelcast.
To view this discussion on the web visit https://groups.google.com/d/msgid/hazelcast/de5e797d-0c6a-4d1a-8e97-758fa97fbbe5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages