Reconnect after server restart
See original GitHub issueDear RSocket team,
First of all, I am playing with rsocket. It looks great so far. This is more of a question.
This is a very simple spring boot service class for rsocket client. As you see we establish rsocket connection as part of constructor, cache the requestorMono. The below code works perfectly fine as long as server is not restarted. When you restart server, the connection is broken. Client needs to be restarted to make this work. The retry
in the ping chain will NOT help as it is cached already. Is there any built in approach in rsocket to handle this?
@Service
public class RSocketPingService {
private final Mono<RSocketRequester> requesterMono;
// Spring Boot is creating an auto-configured RSocketRequester.Builder bean
public RSocketPingService(RSocketRequester.Builder builder) {
this.requesterMono = builder
.dataMimeType(MediaType.APPLICATION_CBOR)
.connectTcp("localhost", 7000).retry(5).cache();
}
public Mono<String> ping() {
return this.requesterMono.flatMap(requester -> requester.route("pong")
.data("TEST")
.retrieveMono(String.class));
}
}
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
How to reconnect to a socket after server restart - Stack Overflow
Just reconnect from the client. But if you have multiple fail-over servers you wouldn't want to reconnect to the one that just failed,...
Read more >Restore connection after server restart | OPC UA Standard
I tried session.Reconnect() but it throw BadSessionIdInvalid exception. And i tried session.Recreate(session) , in this case ServerState becomes ...
Read more >OpenVPN reconnect after server restart
I have an OpenVPN server and some clients which only have access through the VPN. Sometimes, I need to restart my OpenVPN server....
Read more >Client reconnecting after server restarts - MSDN - Microsoft
When a server goes offline -- it reboots, fails, the app domain recycles, etc. -- the result might be similar to a lost...
Read more >Client won't reconnect until server restarted. : r/WireGuard
After the client reboot the last handshake was the moment before reboot. I waited until it was about ten minutes. Last handshake on...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @uselvvi!
It is great to get more users on board!
Have you looked at build-in reconnect feature which does exactly what you need:
@nbabic298 I just checked the SO answer as well. It seems to match with what I have in this repo as well. Check your version. I use 2.3.2.RELEASE.