简单的微服务框架 [英] Simple Microservice framework

查看:100
本文介绍了简单的微服务框架的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一段时间以来,我一直在寻找一种快速,简单的微服务框架解决方案.我对所有Lightbend产品& scala,但由于它看起来非常有趣,因此我决定尝试一下.

几个问题:

1)我不明白为什么需要新的框架Lagom?

如果play已经可以给我相同的解决方案(用作微服务),那么为什么需要另一个框架?

2)通过玩游戏,我设法快速创建了一个"Hello World"项目,并且部署也非常简单,直接(通过dist).

我喜欢这样一个事实,我可以将所有合并成一个ZIP并通过script运行它.据我了解,在Lagom中,我需要使用ConductR.

对于我当前的需求,它看起来像是一大笔开销.为什么要在游戏中部署类似的东西?

谢谢大家

解决方案

Lagom建立在Play之上. Play旨在成为通用(异步)Web框架,而Lagom的更具体目标是添加一些专注于将应用程序部署为微服务的工具/观点.

Lagom提供的一些示例可帮助您实现微服务风格的体系结构(Play则没有):-

持久性

例如,它添加的一件事是

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

解决方案

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.

这篇关于简单的微服务框架的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆