Simple Microservice framework [closed] - scala

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
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

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.

Related

Scala, Akka, Lagom, Play, Reactive and Microservices [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I've been meaning to create MicroServices using Scala. Later we may need some web pages as well.
What is Reactive programming in terms of Micro Services or REST HTTP?
What is the relationship (if any) between Play, Lagom and Akka? Are they all used in making Micro Services?
Is Play Reactive?
Can MicroServices serve dynamic Web Pages? Or do I need a separate application for that?
I have done some work with ReactJS. Does that fit anywhere in the picture?
Please help
The question is a bit too broad to answer it here. But Jonas Bonér, the creator of Akka, explores the relationship between Microservices and Reactive Systems in his free ebook "Reactive Microservices Architecture", why don't you read that for a start.
Akka is a library/tookit, it's more low-level and doesn't guide you towards using certain patterns as frameworks do. Play and Lagom are both frameworks that prescribe, to a certain extend, a structure, and provide more architectural guidance for your application. They are both built on top of Akka. There's quite a bit of overlap between Lagom and Play, e.g. you can use either to write RESTful HTTP services. Historically Play is a "full stack web framework", including server side rendering of HTML pages. Lagom is younger, was built explicitly for microservices, and has a lot of built-in support for typical architectural patterns and challenges in that area (e.g. service lookup, async messaging between services etc.)
Yes, absolutely. For more info on that see for example "What Makes Play Frameworks Fast"?
There are different schools of thought, some say services should provide their own UI, others will have a separate service for that. If you look at Lagom sample applications like Chirper or Auction, you'll see that server-side rendering of pages in there is done by Play applications, which use Lagom services as their backends.
Yes, you can write you client application (which will run in the browser) with ReactJS and the server side with Lagom and/or Play, no problem.

Building an REST API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I am working on a project where we are looking to build a REST API from scratch. So my initial thoughts were to utilise one of the relatively new aysnc non-blocking I/O frameworks.
I've been looking at the Typesafe framework (Scala, Akka, Play).
Is this a good solution for a RESTful API?
Are there any good (up to date) tutorials/examples that people could provide links to?
Also, I came across spray.io. From what I can gather this seems to be a good alternative to using Play if all I want to build is a REASTful API?
Is that true?
Any good tutorials for this?
I would really like to use Akka and its Actors model from the outset.
Separately I read that Typesafe acquired spray.io to integrate it into the Typesafe framework.
Has this been done yet? If I download the latest version of Typesafe do I get spray bundled in with it?
Finally, hosting. What would people suggest for hosting such an API with this type of framework? AWS, Google, Cloud Foundry, Heroku?
The service will ultimately need to be extremely scalable.
Does anyone know of any good links that cover a lot of the above? i.e. deploying a spray based API on Cloud Foundry for example?
Thanks for the help.
Your question is far too broad, prone to opinion-based answers. Anyway, my two cents:
I've been looking at the Typesafe framework (Scala, Akka, Play). Is
this a good solution for a RESTful API?
IMHO, the best current solution if you want to both grow your system and sleep in peace.
Are there any good (up to date) tutorials/examples that people could
provide links to?
Plenty of them, all around. Check the following, for example:
http://akka.io/docs/ (the official Akka documentation, which I find great)
https://typesafe.com/activator/templates (templates for almost anything you would want to learn/do, including Akka, Play, Spray, and many more)
https://www.playframework.com/documentation/2.3.x/Home (official Play documentation, in case you want to use it)
Also, I came across spray.io. From what I can gather this seems to be
a good alternative to using Play if all I want to build is a REASTful
API? Is that true? Any good tutorials for this?
If you are planning to do only a RESTful API, yes, seems like a good way to go. For tutorials, see the official site and the activator templates listed above.
Separately I read that Typesafe acquired spray.io to integrate it into
the Typesafe framework. Has this been done yet? If I download the
latest version of Typesafe do I get spray bundled in with it?
As far as I understand, Akka is implementing its very own http module, based on the work of spray.io team. See here for more details. Play will be eventually built upon the Akka streams and http modules. It's still marked as experimental and the process is still going. You can use spray in your project just adding the dependencies. There's no such thing as "latest version of Typesafe", unless you are speaking about the Typesafe Activator, which is the bundle of tools (including Play and Akka and some nice web interface) provided by Typesafe. Normally, what you need will be downloaded automatically. See the examples for more information.
Finally, hosting. What would people suggest for hosting such an API
with this type of framework? AWS, Google, Cloud Foundry, Heroku?
No idea. Until now I have been using AWS successfully, but since I have not tried other options, I can not give opinion on that.
Does anyone know of any good links that cover a lot of the above? i.e.
deploying a spray based API on Cloud Foundry for example?
For Cloud Foundry specifically, I don't know one.
Hope it helped!
P.S.: your question is too broad. Try in the future to present real concrete problems and your attempts to (unsuccessfully) solve it.

Is it easy for a PHP Developer to create own framework? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I would like to create a website similar like imdb.com. Whether imdb.com uses any framework? if so which framework it uses? Otherwise are they developing on their own? Is it easy for a normal PHP developer to create my own php framework?
As a PHP developer:
I have my own php framework, So you can say it's not so hard; But you must first learn how other frameworks work... And decide what your framework need to do... Which design patters you agree with...
Most of big websites didn't use famous frameworks, Or even their own frameworks... Mostly using a plenty of libraries... Because when you use a framework you code faster but you waste resources as RAM, CPU IO/Disk...
A well programmed application is this one that use 100% of its code source, It's good to go OOP, MVC... But not in the way most of frameworks works... This what is life less working time cause a less quality project.
There are two reasons why you would want to create your own framework:
Learning purposes, it's a great learning opportunity because you
will learn a lot.
This one I highly doubt is a issue for you, but
If you believe your framework can be different and better in some
way than those already existing, go for it.
A framework isn't the application, a framework is a tool set that lets you get straight on the application itself, instead of writing a database abstraction layer you learn how built-in in works and writes the busniess logic your application needs.
Developing a new framework is not a trivial or easy work at all. Even for a team is difficult to handle, so be extremely sure you need to create yet another one before starting.
Instead, use open source, well known solutions, so that bugs are likely to be triaged and fixed. There are many which are available even for commercial use. Just choose your favourite one: Symfony, Code Igniter or Kohana or whatever and start building your application on top.
As of IMDB, probably they are using a framework, but there is no way to tell what if any.

Recommended serverside architecture(framework/stack) to use with GWT for large application [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I've been doing research on this for the past 2, almost 3 days now. I feel like I've googled everything under the sun on the matter (including these forums) and am almost all tutorialed-out. Before I go into any more details on the question I just want to give a quick overview of the scope and plan for the project to see what will suit it best:
-Large application, non-trivial
-50+ DB tables
-Large user base
-User management/authentication/sessions
-transactions
-security
-MVP (as per GWT recommendation)
-focus on performance and scalability (naturally :), am using GWT after all)
-Prefer to stick with Java serverside
I've also read and watched all of the best practices on architecture for large applications (Google/GWT). In the last talk I could find on best architecture practices involving GWT was back in 2010 by Ray Ryan in which he states that they don't think JavaBeans and property change events work terribly well so it's better to use DTOs for the Model.
The 2 frameworks that came to the forefront in my searching were Seam and Spring.
Sticking with MVP, my domain would for the most part be a data service with a thick client. However, I would still like the serverside to have security and session capabilities since I'd like users to be able to keep state even if they don't use cookies and they end up refreshing for example. I would also like to have an ORM like Hibernate to manage a lot of the transactional aspects. I'd like to still use RequestFactory and have really been considering Spring.
I guess I can narrow my question down to:
Considering the above, what would the recommended application stack be for a large GWT application, specifically for the serverside and integration with GWT?
This is my first project of this scale and the last thing I want to do is head down the wrong path on losing a lot of time and energy. Thanks a lot in advance for your help, I really just want to figure this out so I can get back to coding instead of googling the ends of the earth ;).
-Seth
I've also already looked at Best architecture for applications in GWT which I found might be the closest to this, but it didn't really answer my question and I feel mine is a little more targeted with a more specific use case
I don't have any experience with Seam, however I am working on a relatively large project using GWT on the frontend and Spring on the backend and so far it works really well (RequestFactory, JPA2/Hibernate, PostgreSQL). BTW you can also checkout JBoss Erai
The good thing about using Spring is, that adding new features is quite easy. For example I added support for openid authentication and all I had to do is define an additional dependency in maven and some additional lines in the configuration file and now authentication via google,facebook, twitter account works out of the box.
This layered approach has a lot of advantages.
But if you really stick to the best practices of developing GWT apps (MVP, etc), you will end up with two more or less separate projects. This is a little bit different then when you would develop traditional Spring MVC/Web Flow apps where you have more or a less only one projects (btw: check out Thomas Broyer's gwt maven archetypes which helps you come up with a good project structure).
In addtional to this when you use MVP on the client side your backend will actually only serve as a data service which feeds your GWT client with data. All the flow synchronization will be handled in your GWT app.
So you will probably not use many of the backends functionality (i.e. the MVC part of Spring MVC).
I use RequestFactory for data communication between backend and frontend and for CRUD applications this works really well (it also supported from Android btw).
However if you want to support a more clients you might rather use a Restless approach. Again by using Spring on the backend it is relatively easy to add Restless support to your app and there are a couple of 3rd partys libraries supporting restful services in GWT (RestyGWT, Restlet).
Here are some thoughts on the development process:
Use a dependency management system like maven. It makes it really easy to develop in teams and split up your projects in manageable units/modules (for example a GWT maven app can be split up in a frontend part (GWT), backend (Spring) part and a shared (comong DTO's, etc) part.
Try to do test driven development (TDD or BDD). For example before you create a service function in your Spring backend (i.e. getAllProducts()) write a Unit test for it. This also helps creating a good Service layer because by writing Unit tests you define what the service layer is supposed to do.
"Premature optimization is the root of all evil": Don't put too much time in early optimizations.
Think about buying/using JRebel, especially if you use Spring. A relatively large Spring app can have a relatively large startup time. JRebel helps you to change classes in the backend without a reloading/restarting the application. It saves a lot of time.
Implementing ACL on domain level is not an easy job. There are ACL classes in Spring Security and they work fine for simple use cases however if you have complex use cases (for example filter a list of items based on ACL entries) this can be quite involved if you want to do it efficiently. On the other hand with Spring it is relatively easy to use another library (i.e. Apache Shiro). Futhermore you have to make sure that you display the correct controls on the frontend (i.e. no Edit button if the user doesn't have edit permission, etc). With JSP that is easy because you create the UI (HTML page) on the backend. In GWT you have to do it yourself.

Advice for build multiusers big website (1. scala lift/spring roo 2. database mongoDB/Postgre ORM/MySql ORM 3. Web-server environment Tomcat etc..) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I need advice for build multi-users big/huge website - I am the only programmer and the owner of this website, doing that in my free time + my money (meanwhile).
(I have few years of experience as Web Programmer(Lamp,Ubuntu, Zend, Mysql Doctrine ORM, Jquery) - I want to give try for JVM static type langs java spring roo/scala
I know Java + JSP+ Servlets + Beans but not Spring Roo/Spring MVC or Scala.
)
My Questions(Please answer according 1. stability of solution 2. price 3.time to program 4. time to study this technologies 5. etc..):
which lang/framework choose scala lift/spring roo - Important what more
Which database mongoDB/Postgre ORM/MySql ORM
Hosting (I thinking to take amazon Ubuntu package)
Web-server environment to run website (I know lamp, but Java I dont know about servers (Tomcat for run java?,Apache for HTTP - please give me good option that will not cost me a lot money, prefer free and stable)) - I saw Cloud Foundry - really cool, but its beta version.
Thanks in advance
Here are a couple of presentations on why Foursquare chose Lift:
https://docs.google.com/present/view?id=dcbpz3ck_24f3v83ggz
http://www.vimeo.com/8057986
Keep in mind that at the time of the presentations, Foursquare had 1 full time engineer (Harry the guy giving the presentation) and nearly 1M users.
Foursquare has been able to securely scale with Lift and MongoDB.
See this comment about Foursquare's security: http://twitter.com/#!/rasmus/status/5929904263
And of course, Foursquare put Lift in space
The folks at http://openstudy.com have a tremendously cool real-time multiplay online learning site. They have done it with 1 full time engineer and a couple of interns.
The folks at http://vibe.novell.com have built a very powerful, scalable system on Lift (although they have a fair number of engineers working on the project.)
In my experience, Spring Roo is good for rapidly building a CRUD application and to set up a project (so, you don't have to write all that xml config stuff for spring, it will be generated by Roo for you). In comparison, Lift is a full stack web framework and scala a more feature-rich language than Java. Here I would prefer Scala and Lift. Altough both have a steep learning curve.
Depends on your data model. ;-)
Not enough information about that.
Here I you can choose any webcontainer you want (Tomcat, Jetty).
I think in you case the best choose play framework