I'm creating a Java Web Application that predicts bitcoin price. I have 3 important "parts" there:
Now these parts are in a single jar stored in different packages. I feel they're completely different and storing them in distinct packages is not enough!
I believe that they should be somehow independent: for example, if there is an internal server error, I don't want to shutdown the self-optimizing of machine learning model just to see what's happened with Tomcat.
My business logic should work continuously and each part should work independently of any parts that it doesn't need. Maybe they should be in three different jars? Did anyone have experience with it? Or maybe someone knows how different logic parts are separated in a big enterprise projects?
IMHO
There are 2 different aspects that you are raising
‘Package question’ - this is about code organisation / modularisation
This helps to keep code modular so you can separately build and test parts of code not directly coupled.
‘Internal server error should not stop ML’.
This is deciding how many runtime components / sub components - you are running.
In your case - there appear to be 2 services - UI & ML.
You can run choose to run
1 app with 2 services (as you are doing now)
or 2 distinct apps with 1 service each
Based on complexity, runtime demands, ….etc you can choose either
Note: if the services are sufficiently fail-safe for common use-cases, you can live with 1 APP.
If you choose 2 distinct apps (1 each for UI and ML), it makes sense to split the code into 2 sub-projects