Win a copy of Head First Go this week in the Go forum!

Tibi Nemon

Greenhorn
+ Follow
since Feb 23, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Tibi Nemon

I'm fairly new to Spring Boot, and would like to get some information to allow me to best handle running an application inside the Spring container.

Basically, I have a FIX engine (accepts and sends FIX messages). I could have this as a standalone java application (client-server), but I decided to go for Spring because I'm leveraging its ease of use for hibernate + dependency injection. I will also have to eventually implement a front-end so that will be easy to setup with Spring.

What I'm currently doing is running my engine via the CommandLineRunner. That initiates everything I need (sockets and all), and listens for incoming messages. Once I get the LOGOFF message, I exit my application gracefully (System.exit(0) with a ShutdownHook -- though another option would also be to have the engine be on 24/7).

My question is if I'm using the Spring container properly, or if there's a better way? For example, should I be decoupling the Spring application from the engine itself? Most things I see on the internet about CommandLineRunner is they allow you to run a piece of code to initialize something before your main application starts, but I'm full on running an entire FIX engine. Maybe there's something I'm missing about the relationship between a Spring container and its underlying application.

Any help greatly appreciated, this will be the first time I push something this big in production. Also, I've posted the same question over on StackOverflow. So you can answer on both forums if you want rep there too (hope this isn't against this forum's rules).

Thanks
1 month ago