Simple Microservice framework [closed]

大憨熊 提交于 2020-01-14 06:31:11

问题


For a while I was looking for a fast and simple solution for a microservice framework. I am quite new to all Lightbend products & scala but since its looks very interesting I decided to give it a try.

Few Questions:

1) I don’t understand why there is a need for the new framework Lagom ?

If play can already give me the same solution (to serve as microservice) then why there is a need for another framework ?

2) With play I manage to create an “Hello World” project very fast and also the deployment was very easy and straight forward(via dist).

I like the fact that I can merge all in one ZIP and run it via script . In Lagom from what I understand I need to use ConductR.

For my current needs its look like a big overhead. Is there a simple why to deploy it something like in play ?

Thank you all


回答1:


Lagom is built on top of Play. Whereas Play is intended to be a general-purpose (asynchronous) web framework, Lagom's more specific goal is to add some tools/opinions focussed on deploying your app as microservices.

A couple of examples that Lagom provides that helps you realise a microservices style architecture (that Play does not):-

Persistence

One thing it adds, for example, is an API for CQRS-based persistence on top of the persistence support Play currently provides - this (if you do not know) is a pattern which helps you realize a microservices architecture by decoupling queries and commands.

Container Orchestration

Let's say you have a Play application that has 25 different microservices - which is probably a conservative number for say even a relatively small corporate application - how do you manage the deployment/orchestration of all those JVM's? Well containers are all the rage. How do you manage all those containers? ConductR is a tool which takes some of the pain away from that task, and Lagom provides you integration tools for ConductR to make it easier for you to use it with your Lagom project - something you do not get with Play on it's own.

I could still achieve this with Play

Ok, there are loads of SBT modules that you could use in your Play project to help you realise the same thing but then you need to choose what tools you need, figure out which of the many modules available are right for your project, configure and wire them as necessary - this is one of Lagom's goals - to take these decisions and configuration tasks away from you so you can focus on writing your application logic.

If my application was small, maybe just 5 services, then you could argue quite convincingly that you really don't need Lagom (or any other microservice framework for that matter). However, if your application is likely to grow, then Play on it's own will cost you more time in the long run.

There are obviously many more considerations when designing microservices but you get the jist of Play vs Lagom.



来源:https://stackoverflow.com/questions/40920468/simple-microservice-framework

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!