micronaut-gradle-plugin
micronaut-gradle-plugin copied to clipboard
FileWatchRestartListener shutdown for multi project build/application
So I am evaluating Micronaut for a microservice application which we will need to build an application with multiple sub project and live reload feature seem to shutdown if there are more than one Micronaut application on the build.
If I go to individual service and run the application from there, live reload works correctly.
Also if I take out other sub projects and just leave one sub project on build, live reload also works correctly.
The test were made is based on this GitHub project:
https://github.com/micronaut-guides/micronaut-microservices-services-discover-consul
Task List
- [✓] Steps to reproduce provided
- [✓] Stacktrace (if present) provided
- [✓] Example that reproduces the problem uploaded to Github
- [✓] Full description of the issue provided (see below)
Steps to Reproduce
- Checkout the project above.
- Start the application on root folder using command:
./gradlew -parallel run --continuous
- Open the following link which it should appear correctly:
http://localhost:8081/books
- Change code on BooksController
- Open the same link on step 3 and the link becomes inaccessible due to Micronaut application shutting down.
Expected Behaviour
On refresh, the change should show up.
Actual Behaviour
Application die but only the application that was changed. The error returned is:
08:33:25.350 [micronaut-filewatch-thread] INFO i.m.r.s.w.e.FileWatchRestartListener - Shutting down server following file change.
Full stack trace:
https://gist.github.com/reyjexter/bdfa097f1df4584ec951b8c612ad2c22
Environment Information
- Operating System: Ubuntu 18.04
- Micronaut Version: 2.0.0 and 2.0.0.RC
- JDK Version: OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.7+10)
Example Application
https://github.com/micronaut-guides/micronaut-microservices-services-discover-consul
So it appears that if continuous mode is enabled and parallel is enabled we shouldn't be blocking run
since what is actuallly happening is that the first application is run which then blocks all the other applications from running so when you make a change the next app gets its chance to run.
A solution to this could be to implement our own version of run
that somehow doesn't block if continuous mode is active.
In the meantime you need to run the applications individually
I can confirm that running each Micronaut sub project separately worked instead of using gradle parallel run.
There is an error that says it's not able to start server as port is already in use but it does correctly reload the application so this error can be ignored.
Thanks for the workaround
@graemerocher What's the criteria or how does an issue usually get included next round of releases or bug fix? The workaround does work now and a smaller project shouldn't have problem dealing with this but as soon as the number of microservices increases then it might make things more difficult.
An example is that we are only looking at around 5 microservices in the beginning but we could look at that going over 20 in the next 3 months.
In general depends on user demand, you are currently the first person to ask for this feature, though I see 2 people have given a thumbs up. We are going to be working on some new Gradle plugins so maybe this makes sense to include as a feature there.