SoftInstigate / restheart

Rapid API Development with MongoDB
https://restheart.org
GNU Affero General Public License v3.0
807 stars 171 forks source link

how to work within springboot app? #344

Closed f5cs closed 5 years ago

f5cs commented 5 years ago

hi every one! have any none know how to embedded the restheart into a springboot application?

i have read torsten-liermann's pull request commets,but there some thing miss:RestHeartConfigurationProperties.java,RootHandlerForRestHeartDispatching, also how to use this is not to explain.

ujibang commented 5 years ago

Hi @f5cs!

We didn't merge that (quite old) PR since at that time we thought that embedding RESTHeart in an application server won't really add any advantage compared to just running it in a separate process.

At the end of the day RESTHeart runs it own http server anyway!

However if you could detail more your use case we can consider adding this feature in the future; take into account that RH is built on top of undertow so I would really make sense to follow the same direction of @torsten-liermann's PR.

I would like to hear also from @torsten-liermann

ujibang commented 5 years ago

Ah I saw that springboot allows Embedding Undertow directly. Interesting....

f5cs commented 5 years ago

Hi ujibang,Thank you for your reply. I am preparing a large data service solution with a large number of commercially independent mongodb nodes on the back end.

I want to instantiate several RESTHeart service nodes to access these mongodb nodes separately, and then use spring cloud Eureka to build solutions to achieve automatic registration and discovery of these RESTHeart service nodes to unify the management of these RESTHearts, using Zull and Hystrix of spring cloud to unify routing scheduling to access RESTHeart nodes.

I took a preliminary look at the RESTHeart code and found that RESTHeart had a lot of customization at the code level for its deployment on undertow and started undertow. Spring cloud also uses spring boot to initialize its internal deployment process and start undertow.

I can start undertow with spring boot, but I didn't initialize the context of RESTHeart successfully, so the function of RESTHeart can't be used properly. I tried to connect the two with Undertow Servlet WebServerFactory. addDeployment InfoCustomizers, but failed (it's because I'm not familiar with this place).

I also tried to start with RESTHeart, but the Spring Application. run () deployment chain was not executed, which resulted in the incorrect deployment of spring cloud features.

Bootstrapper. run in RESTHeart and SpringApplication. run () in Springboot execute their respective initialization, deployment and startup processes. I can't figure out how to coordinate them in a short time.

ujibang commented 5 years ago

@f5cs can you reach me at andrea @ softinstigate.com so we can schedule a call to further discuss this requirement?

ujibang commented 5 years ago

closing this due to lack of activity. feel free to reopen if any news