failover-vaadin
Browser-side fail-over
Browser-side failover implementation. If the connection to the primary server is lost, the browser will automatically redirect itself to a fallback/spare server of your choosing.
Advantages:
- No single point of failure
- Incredibly easy setup - just add Maven dependency on this add-on and recompile your widgetset.
- No server-side clustering needed
- Servers are totally independent one from another - you may even use a mixture of server kinds, different versions of application, ...
Disadvantages:
- Session is lost on failover
- If the main server dies, new clients cannot connect.
- If the main server dies and the user presses F5 in the browser, she will just get "Connection Refused". This could perhaps be remedied by offline mode.
Features:
- Supports multiple fallback servers to reconnect to, either in round-robin or random-robin.
- Prior reconnecting the URL is pinged first, whether the spare server is actually alive.
- A simple load-balancer, by selecting a random server from the list instead of always choosing the primary one.
- The user must initiate the failover process manually. This way she will understand that the server has crashed and that she may lose some data (that is, the session).
Future improvements:
- Offline mode of the bootstrap page, which will connect to the spare server even in case when the primary server is down.
For tutorial, please see homepage
Sample code
@Widgetset("AppWidgetset") public class MyUI extends UI { @Override protected void init(VaadinRequest vaadinRequest) { final List<String> urls = Arrays.asList("http://www.example.com", "http://www1.example.com", "http://www2.example.com", "http://www3.example.com"); final FailoverReconnectExtension reconnectExtension = FailoverReconnectExtension.addTo(UI.getCurrent()); reconnectExtension.setUrls(urls); reconnectExtension.setInfinite(false); reconnectExtension.setRandomRobin(false); reconnectExtension.setPingMillis(5000); getReconnectDialogConfiguration().setDialogText("Can't connect to the server. The network may be down, or the server has crashed. Press the 'Try Spare Servers' button to try to connect to fallback server."); ... } }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
Vaadin 8 version of version 0.0.2
- Released
- 2019-01-15
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 8.0+
- Vaadin 7.6+ in 0.1.3
- Browser
- Firefox
- Opera
- Safari
- Google Chrome
- iOS Browser
- Android Browser
- Internet Explorer
- Internet Explorer
- Windows Phone
- Microsoft Edge
failover-vaadin - Vaadin Add-on Directory
Browser-side fail-overBrowser-side failover implementation. If the connection to the primary server is lost, the browser will automatically redirect itself to a fallback/spare server of your choosing.
Advantages:
* No single point of failure
* Incredibly easy setup - just add Maven dependency on this add-on and recompile your widgetset.
* No server-side clustering needed
* Servers are totally independent one from another - you may even use a mixture of server kinds, different versions of application, ...
Disadvantages:
* Session is lost on failover
* If the main server dies, new clients cannot connect.
* If the main server dies and the user presses F5 in the browser, she will just get "Connection Refused". This could perhaps be remedied by offline mode.
Features:
* Supports multiple fallback servers to reconnect to, either in round-robin or random-robin.
* Prior reconnecting the URL is pinged first, whether the spare server is actually alive.
* A simple load-balancer, by selecting a random server from the list instead of always choosing the primary one.
* The user must initiate the failover process manually. This way she will understand that the server has crashed and that she may lose some data (that is, the session).
Future improvements:
* Offline mode of the bootstrap page, which will connect to the spare server even
in case when the primary server is down.
For tutorial, please see [homepage](https://github.com/mvysny/failover-vaadin)