Spring Package. Is it possible to deviate from errors differently for different exceptions?
So, for example, I have 3 levels of exceptions, minor, regular, critical. In an ideal world, I would like to have 3 listeners in the application for these exceptions and if 10 minors or 5 regular or 1 critical, I terminate the application and send a notice to the interested parties. Is this possible or is there a way I could develop this behavior?
source to share
You must do this using the Spring Batch mechanism SkipPolicy
.
Spring package provides several implementations SkipPolicy
for controlling resiliency: AlwaysSkipItemSkipPolicy
, CompositeSkipPolicy
, ExceptionClassifierSkipPolicy
, LimitCheckingItemSkipPolicy
and NeverSkipItemSkipPolicy
.
If none suits your needs, it's probably easy to make your own implementation SkipPolicy
.
source to share
I thought you could create a database table that could log errors and each record could be associated with a session ID, assuming it could be a web application. Do a separate job every 5 minutes to poll the database table to meet these criteria. If it was Android platform, you can use RX Java and send push notification using Google Firebase.
source to share