Reputation: 362
I am making a High Availablity cluster (Active-Active) in which each node is connected in Line topology (Point to Point connection).
Each node (Java application running on each node) is connected using Netty channel. My question is, how would a Node know whenever there is a connection break with its peer (either right or left)? So that I can restart establishing Netty connection between the nodes.
Can I use channelInactive(ctx)
method in the handler for this purpose? Or is there any other solution?
Cause of connection break could be anything: Application forcefully stopped on one node, Exception occurred, I/O operation failing etc.
Upvotes: 1
Views: 317
Reputation: 23557
You can use channelActive
.... That said if you want to detect a remote peer that did go away you will need to implement some sort of "heartbeat" into your protocol to notice it in a timely manner.
Upvotes: 1