I'm building an application that relies heavly on the CDI event model. During the login process an event is fired to the server to check the given credentials. If there ok then another event is fired to aimed at the client which will cause the app to procedd with the login. Before I tries to send the event to the server I stopped the server. Then I pressed the submitt button to send the message. Obviously since there is no server running now there is no return coming back. The app just sits on the login screen waiting for the return. Is there a way to detect that the bus is not connected to the server any longer? I looked into the Lifecycle listener bbut that doesn't seem to work? I'm using the latest 3.0-SNAPSHOT. Any guidence would be appreciated.
Yes, you can monitor the state of the client message bus by registering a BusLifecycleListener on the client. Here's an example of a GWT widget that turns different colours depending on the bus connection status (feel free to copy it as a starting point):
And here's how it gets registered with the bus:
Hope that helps!