-
March 27th, 2024, 09:10 PM
#1
Exception handling when migrating from java SE client version 2.5.2 to 5.0.0
Hello, we are migrating our Java SE client version from 2.5.2 to 5.0.0.
In the old version we have been catching exceptions like PushConnException, PushServerException, PushUserException, SubscrException. There is also a onActivityWarning() method under the ExtendedConnectionListener class.
In the new version, if I understood correctly, we get all these exception scenarios through the method ClientListener.onServerError(int errorCode, String errorMessage).
My question is, how can we catch the same exception scenarios? Is there a one-to-one matching from the old exception classes to the new errorCodes? Thanks!
-
March 28th, 2024, 09:17 AM
#2
In the new version, the interface has changed significantly. Some notable changes are:- All the interaction has become asynchronous. As a consequence, all the error conditions are now received only via callbacks. Synchronous exceptions upon method invocations are possible only in case of wrong parameters.
- The library now handles the connection lifecycle and attempts automatic retries upon connection errors. Hence, transient problems due to connection issues are now hidden. The library informs the application of its work through a onStatusChange callback.
- The interaction with the Server uses a different protocol (TLCP). The codes related to the various error conditions are the same, but a few new error cases have been introduced.
For these reasons, there is no direct mapping of exceptions. We assumed that, by refurbishing the application to apply to the new interface, exception handling would also be revised.
If you have a sophisticated exception handling policy and want to keep the logic, here are some notes:
- If you handled connection issues, you should now lean on the library handling and set the related parameters in ConnectionOptions. You can enforce a custom retry logic by intercepting the onStatusChange callback. We can expand on this point, if needed.
- Errors issued by the Server are still available. The cases in PushServerException and PushUserException have been merged in the same set, but have been separated based on the context. Now they are available in onServerError, if related to connection establishment, and in onSubscriptionError of the SubscriptionListener, if related to subscription requests.
-
March 28th, 2024, 01:18 PM
#3
Thanks for reply! We used to log specific messages according to the exception type which then trigger alarms in our system.
In this case we just need to understand the error scenarios and trigger alarms accordingly.
In order to understand that,
1. In the TLCP specification (https://www.lightstreamer.com/api/ls...client/latest/), does Appendix A list all possible errorCodes we'll get through onServerError?
2. Does Appendix B list all possible errorCodes through on SubscriptionError?
3. Is there a list of all possible "status" that we get from onStatusChange callback?
-
March 29th, 2024, 08:32 AM
#4
For 1 and 2 I confirm that the errors reported by onServerError and onSubscriptionError are related to the lists in appendix A and B, respectively.
However, some error cases are handled by the client library and hidden to the application; moreover, errors related to wrong requests are not possible if the requests are issued by the client library.
Obviously, the errors are related to the requests performed, hence some of them are not possible if the application doesn't use the related features.
A further error code for onServerError, named 61, is produced by the client library if something unexpected comes from the Server.
For the above reasons, the error listings in the documentations of onServerError and onSubscriptionError should be a better reference.
For 3, you can refer to the documentation of onStatusChange. As you can see, the state can change for many reasons.
Similar Threads
-
By ManKeer in forum Client SDKs
Replies: 3
Last Post: June 8th, 2022, 01:41 PM
-
By KalS in forum Client SDKs
Replies: 5
Last Post: February 4th, 2016, 10:43 AM
-
By romainmoreau in forum Client SDKs
Replies: 9
Last Post: December 1st, 2014, 06:04 PM
-
By emese in forum Adapter SDKs
Replies: 1
Last Post: July 21st, 2011, 10:16 AM
-
By gerald.logor in forum Client SDKs
Replies: 7
Last Post: May 16th, 2008, 05:25 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
All times are GMT +1. The time now is 10:46 PM.
Bookmarks