Which are Scala alternatives for MDB or JMS? - scala

I am now in the process of convincing my boss to start using Scala for our web application. I shown him some nice features and frameworks (Play 2.x) where Scala power is greatly noticed and now he comes up with a question where I need some Scala expert's advices:
what are the frameworks used in Scala for building queue based message processing (same as MDB and JMS) and what transaction management systems are used and how they compare with EJB based container managed txns ?
Because I don't have to much experience with Scala, I am pretty lost in finding documentation about this question. Can you please give me some suggestions?

Related

Diagram tool for actors

Is there any thing that can generate a sequence diagram between actors in akka?
Or any kind of diagram in akka?
I use sbt 0.13.13 with scala 2.11.8, akka 2.4.16
The idea of general visualization of akka actors (mailboxes) is quite fresh, so there is not much in terms of existing frameworks for it. The one I came around and seemed closest to kind of general solution was akka-visualmailbox.
They also have sample project and comprehensive installation instructions in README.
The best part of this one is that it does not require code changes.
Another one that does is akka-message-visualization however I did not see any simple setup guides out there for it.
Use Lightbend Telemetry Visualization tools
Specially look into Vizceral Visualization tool
I'm currently building one called Muse, it's still in early stages, but I have already begun using it at the office. You can select one or more messages and generate a sequence diagram from them.

HTTP messaging gateway with Scala

I'm developing a gateway that will be located between mobile web apps and web services on backend systems. The purpose of this gateway is to protect web apps against changes to backend web service api's, to introduce concurrency, transform messages, buffering, etc.
My proposed architecture is as follows:
Platform independent mobile web apps using PhoneGap (done)
Gateway is a web service using Scala for business logic and ZeroMQ for message passing (new)
Backends are existing web services (existing)
The gateway is purely responsible passing, translation, aggregation, etc. of messages and does not need to keep state or do user authentication at this point - it's simply responsible for being a single interface that knows how to talk to mobile apps on the one side and one or more services on the other side.
I'm strongly considering using Scala as the development language because it seems well suited for this type of application, but what would be the correct architecture for such a Scala service? I looked at frameworks such as Lift and Play and also considered doing a simple "java" based web service and just use Scala as to implement my business logic. I believe strongly in keeping things as simple as possible. I'm wary of complicated setups and thousands of lines of dead code in frameworks that may never be used. On the other side, limiting oneself to a 'role your own' solution and creating a lot of work and having to maintain code that may have been part of existing solutions is also not ideal.
Some things to consider: I'm the architect and developer, but my knowledge of Scala is limited to the first half of "Programming in Scala, Second Edition". Also, my time is very limited. Still, I want to get this right the first time.
I'm hoping that some clever gent or dame will provide me with insights to this type of solution and maybe a link or two to get started quick. I really need to get going FAST, but hope that the experience or insights of another professional could help me avoid pitfalls along the way. Any insights to development environments and tools will also be helpful. I have to develop on Mac (company rules) but will be deploying on Ubuntu server. I'm currently juggling between installs of Eclipse or Idea as IDE's and the scala compiler or sbt for building.
UPDATE
Thanks for all the potential answers below. I had a look at each and every suggestion and all of them have merit. The problem is now to bet on the right horse. Spray is possibly the simplest solution to the problem, but I also found Finagle. It seams like a stunning solution to my problem. I'm a bit concerned that it is built on top of Netty instead of Akka. Does anyone see any problem with that. I was hoping to keep my solution as purely Scala as possible, but Finagle appears to be the most mature of the lot. Any ideas?
It might be worth taking a look at Akka, which provides a lightweight framework for writing concurrent, fault-tolerant applications on the JVM, as well as useful built-in abstractions for writing web services. In addition, the Spray project looks like it could be useful for your purposes, providing HTTP server and client libraries on top of Akka (Although, unlike Akka itself, I haven't used this so myself so can't vouch for it).
If you're using a web service that is purely for other services, then an Akka based service like Spray or Blueeyes is probably your best bet. You can use Jerkson to do the JSON mapping to and from your case classes and use Akka-Camel to link to ZeroMQ.
As mistertim says, Akka is a good option. I'm biased, but I think Lift and its RestHelper is a fantastic way to go also (I've built several APIs for iPhone apps using Lift). Beyond those, I know several people who are very happy with Unfiltered.
Unfiltered is very interesting option if you want to keep it lightweight, as is not a full blown web framework.
To be honest, the documentation can use more detail, but to provide a web service you just write:
object MyService extends unfiltered.filter.Plan {
def intent = {
case req # GET(Path ("/myendpoint")& Params(params)) =>
for {
param1<-params("param1")
param2<-params("param2")
} yield ResponseString(yourMethod(param1,param2))
}
override def main(args:Array[String]) = unfiltered.jetty.Http.anylocal.filter(MyService).run();
}
Very useful if you don't want to use a framework and don't want to mix java/java annotations with Scala (otherwise, you have the usual java solutions)
Still, I would recommend to look into Akka if you think you think actors will fit your problem
If your system is middle-ware and get the things done quickly, then Spray will be a best. Spray was developed on top of Akka. Akka has ZeroMQ support.
in future if you are going to add some other web like module along with your middle-ware, then choosing Lift + Akka will be better because, Lift also provides Spray like web service stuff + it will be easy to start developing other modules.
You can choose SBT as your build, there are some project templates, template generation tools available, so you can get the project build very quickly.
In my experience , SBT + InteliJ Idea works well, have a look on sbt-idea plugin
Spray Project Template
Lift Project Template Generator

Can you tell me any good scala web frameworks? [duplicate]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've just started learning Scala, and the first thing I'm going to implement is a tiny web application. I've been using Erlang for the last year to implement server-side software, but I've never wrote web applications before. It will be a great experience.
Are there web-frameworks for Scala except for Lift?
Don't get me wrong, Lift looks awesome. I just want to know how many frameworks there are so that I can then choose between them. It's always a good to have a choice, but I the only thing I found was Lift.
I'm very interested in Scala, but I have not used it yet, so with that caveat, the frameworks I am aware of that are not mentioned in HRJ's answer (Lift, Sweet, Slinky) are:
Scalatra, previously Step (on GitHub)
Play 2 (on GitHub)
Pinky
I wrote a blog post about this.
To summarise, some of the options are:
Lift
Sweet
Slinky
I finally found that none were suitable for me, and developed my own little "framework". (It is not open-source yet).
I like Lift ;-)
Play is my second choice for Scala-friendly web frameworks.
Wicket is my third choice.
Following is a dump of frameworks. It doesn't mean I actually used them:
Coeus. A traditional MVC web framework for Scala.
Unfiltered. A toolkit for servicing HTTP requests in Scala.
Uniscala Granite.
Gardel
Mondo
Amore. A Scala port of the Ruby web framework Sinatra
Scales XML. Flexible approach to XML handling and a simplified way of interacting with XML.
Belt. A Rack-like interface for web applications built on top of Scalaz-HTTP
Frank. Web application DSL built on top of Scalaz/Belt
MixedBits. A framework for the Scala progamming language to help build web sites
Circumflex. Unites several self-contained open source projects for application development using the Scala programming language.
Scala Webmachine. Port of Basho's webmachine in Scala, a REST-based system for building web applications
Bowler. A RESTful, multi-channel ready Scala web framework
Try Play Framework, which also support Scala.
One very interesting web framework with commercial deployment is Scalatra, inspired by Ruby's Sinatra. Here's an InfoQ article about it.
I find Unfiltered very interesting https://github.com/unfiltered/unfiltered.
It's mentioned in IttayD's list.
Here is a presentation about it http://unfiltered.lessis.me/#0
and the video http://code.technically.us/post/942531598/doug-tangren-presents-the-unfiltered-toolkit-for
Also here there is an article with more info http://code.technically.us/post/998251172/holding-the-parameter
It must be noted that there is also a considerable interest in Wicket and Scala. Wicket fits Scala suprisingly well. If you want to take advantage of the very mature Wicket project and its ecosystem (extensions) plus the concise syntax and productivity advantage of Scala, this one may be for you!
See also:
Some prosa
Presentation
Some experience with Wicket and Scala
Announcments with reference to the project for the glue code to bind Scala closures to models
Play is pretty sweet.
It is now production ready. It incorporates: a cool template framework,automatic reloading of source files upon safe, a composable action system, akka awesomeness, etc.
Its part of the Typesafe Stack.
Having used it for two projects, I can say that it works pretty smoothly and it should be something to consider next time you are looking to learn new web frameworks.
I tend to use JAX-RS using Jersey (you can write nice resource beans in Scala, Java or Groovy) to write RESTul web applications. Then I use Scalate for the rendering the views using one of the various template languages (JADE, Scaml, Ssp (Scala Server Pages), Mustache, etc.).
There's a new web framework, called Scala Web Pages. From the site:
Target Audience
The Scala Pages web framework is likely to appeal to web programmers who come from a Java background and want to program web applications in Scala. The emphasis is on OOP rather than functional programming.
Characteristics And Features
Adheres to model-view-controller paradigm
Text-based template engine
Simple syntax: $variable and <?scp-instruction?>
Encoding/content detection, able to handle international text encodings
Snippets instead of custom tags
URL Rewriting
Prikrutil, I think we're on the same boat. I also come to Scala from Erlang. I like Nitrogen a lot so I decided to created a Scala web framework inspired by it.
Take a look at Xitrum. Its doc is quite extensive. From README:
Xitrum is an async and clustered Scala web framework and web server on top of Netty and Hazelcast:
It fills the gap between Scalatra and Lift: more powerful than Scalatra and easier to use than Lift. You can easily create both RESTful APIs and postbacks. Xitrum is controller-first like Scalatra, not view-first like Lift.
Annotation is used for URL routes, in the spirit of JAX-RS. You don't have to declare all routes in a single place.
Typesafe, in the spirit of Scala.
Async, in the spirit of Netty.
Sessions can be stored in cookies or clustered Hazelcast.
jQuery Validation is integrated for browser side and server side validation.
i18n using GNU gettext, which means unlike most other solutions, both singular and plural forms are supported.
Conditional GET using ETag.
Hazelcast also gives:
In-process and clustered cache, you don't need separate cache servers.
In-process and clustered Comet, you can scale Comet to multiple web servers.
Follow the tutorial for a quick start.
There's also Pinky, which used to be on bitbucket but got transfered to github.
By the way, github is a great place to search for Scala projects, as there's a lot being put there.
I'd like to add my own efforts to this list. You can find out more information here:
brzy framework
It's in early development and I'm still working on it aggressively. It includes features like:
A focus on simplicity and extensibility.
Integrated build tool.
Modular design; some initial modules includes support for scalate, email, jms, jpa, squeryl, cassandra, cron services and more.
Simple RESTful controllers and actions.
Any and all feedback is much appreciated.
UPDATE: 2011-09-078, I just posted a major update to version 0.9.1. There's more info at http://brzy.org which includes a screencast.
Both Sweet and Slinky seem to be unmaintanted for about a year. Sweet Maven repo sweetsoftwaredesign.com is dead so there's even no way to download dependencies.
Note: Spiffy is outdated.
<plug>
Spiffy:
is written in Scala
uses the fantastic Akka library and actors to scale
uses servlet API 3.0 for asynchronous request handling
is modular (replacing components is straight forward)
uses DSLs to cut down on code where you don't want it
supports Scalate and Freemarker for templating
Spiffy is a web framework using Scala, Akka (a Scala actor implementation), and the Java Servlet 3.0 API. It makes use of the the async interface and aims to provide a massively parallel and scalable environment for web applications. Spiffy's various components are all based on the idea that they need to be independent minimalistic modules that do small amounts of work very quickly and hand off the request to the next component in the pipeline. After the last component is done processing the request it signals the servlet container by "completing" the request and sending it back to the client.
https://github.com/mardambey/spiffy
</plug>
You could also try Context. It was designed to be a Java-framework but I have successfully used it with Scala also without difficulties. It is a component based framework and has similar properties as Lift or Tapestry.
I have stumbled upon your question a few weeks back, but since then also learned about Circumflex. This is a nice, minimal framework that is therefore easy to learn, and it has pretty good documentation available as well.
Beside it's minimal-ness, it also claims to work well with other libraries and lets you use your own implementation of things when you need it.

What Scala web-frameworks are available? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I've just started learning Scala, and the first thing I'm going to implement is a tiny web application. I've been using Erlang for the last year to implement server-side software, but I've never wrote web applications before. It will be a great experience.
Are there web-frameworks for Scala except for Lift?
Don't get me wrong, Lift looks awesome. I just want to know how many frameworks there are so that I can then choose between them. It's always a good to have a choice, but I the only thing I found was Lift.
I'm very interested in Scala, but I have not used it yet, so with that caveat, the frameworks I am aware of that are not mentioned in HRJ's answer (Lift, Sweet, Slinky) are:
Scalatra, previously Step (on GitHub)
Play 2 (on GitHub)
Pinky
I wrote a blog post about this.
To summarise, some of the options are:
Lift
Sweet
Slinky
I finally found that none were suitable for me, and developed my own little "framework". (It is not open-source yet).
I like Lift ;-)
Play is my second choice for Scala-friendly web frameworks.
Wicket is my third choice.
Following is a dump of frameworks. It doesn't mean I actually used them:
Coeus. A traditional MVC web framework for Scala.
Unfiltered. A toolkit for servicing HTTP requests in Scala.
Uniscala Granite.
Gardel
Mondo
Amore. A Scala port of the Ruby web framework Sinatra
Scales XML. Flexible approach to XML handling and a simplified way of interacting with XML.
Belt. A Rack-like interface for web applications built on top of Scalaz-HTTP
Frank. Web application DSL built on top of Scalaz/Belt
MixedBits. A framework for the Scala progamming language to help build web sites
Circumflex. Unites several self-contained open source projects for application development using the Scala programming language.
Scala Webmachine. Port of Basho's webmachine in Scala, a REST-based system for building web applications
Bowler. A RESTful, multi-channel ready Scala web framework
Try Play Framework, which also support Scala.
One very interesting web framework with commercial deployment is Scalatra, inspired by Ruby's Sinatra. Here's an InfoQ article about it.
I find Unfiltered very interesting https://github.com/unfiltered/unfiltered.
It's mentioned in IttayD's list.
Here is a presentation about it http://unfiltered.lessis.me/#0
and the video http://code.technically.us/post/942531598/doug-tangren-presents-the-unfiltered-toolkit-for
Also here there is an article with more info http://code.technically.us/post/998251172/holding-the-parameter
It must be noted that there is also a considerable interest in Wicket and Scala. Wicket fits Scala suprisingly well. If you want to take advantage of the very mature Wicket project and its ecosystem (extensions) plus the concise syntax and productivity advantage of Scala, this one may be for you!
See also:
Some prosa
Presentation
Some experience with Wicket and Scala
Announcments with reference to the project for the glue code to bind Scala closures to models
Play is pretty sweet.
It is now production ready. It incorporates: a cool template framework,automatic reloading of source files upon safe, a composable action system, akka awesomeness, etc.
Its part of the Typesafe Stack.
Having used it for two projects, I can say that it works pretty smoothly and it should be something to consider next time you are looking to learn new web frameworks.
I tend to use JAX-RS using Jersey (you can write nice resource beans in Scala, Java or Groovy) to write RESTul web applications. Then I use Scalate for the rendering the views using one of the various template languages (JADE, Scaml, Ssp (Scala Server Pages), Mustache, etc.).
There's a new web framework, called Scala Web Pages. From the site:
Target Audience
The Scala Pages web framework is likely to appeal to web programmers who come from a Java background and want to program web applications in Scala. The emphasis is on OOP rather than functional programming.
Characteristics And Features
Adheres to model-view-controller paradigm
Text-based template engine
Simple syntax: $variable and <?scp-instruction?>
Encoding/content detection, able to handle international text encodings
Snippets instead of custom tags
URL Rewriting
Prikrutil, I think we're on the same boat. I also come to Scala from Erlang. I like Nitrogen a lot so I decided to created a Scala web framework inspired by it.
Take a look at Xitrum. Its doc is quite extensive. From README:
Xitrum is an async and clustered Scala web framework and web server on top of Netty and Hazelcast:
It fills the gap between Scalatra and Lift: more powerful than Scalatra and easier to use than Lift. You can easily create both RESTful APIs and postbacks. Xitrum is controller-first like Scalatra, not view-first like Lift.
Annotation is used for URL routes, in the spirit of JAX-RS. You don't have to declare all routes in a single place.
Typesafe, in the spirit of Scala.
Async, in the spirit of Netty.
Sessions can be stored in cookies or clustered Hazelcast.
jQuery Validation is integrated for browser side and server side validation.
i18n using GNU gettext, which means unlike most other solutions, both singular and plural forms are supported.
Conditional GET using ETag.
Hazelcast also gives:
In-process and clustered cache, you don't need separate cache servers.
In-process and clustered Comet, you can scale Comet to multiple web servers.
Follow the tutorial for a quick start.
There's also Pinky, which used to be on bitbucket but got transfered to github.
By the way, github is a great place to search for Scala projects, as there's a lot being put there.
I'd like to add my own efforts to this list. You can find out more information here:
brzy framework
It's in early development and I'm still working on it aggressively. It includes features like:
A focus on simplicity and extensibility.
Integrated build tool.
Modular design; some initial modules includes support for scalate, email, jms, jpa, squeryl, cassandra, cron services and more.
Simple RESTful controllers and actions.
Any and all feedback is much appreciated.
UPDATE: 2011-09-078, I just posted a major update to version 0.9.1. There's more info at http://brzy.org which includes a screencast.
Both Sweet and Slinky seem to be unmaintanted for about a year. Sweet Maven repo sweetsoftwaredesign.com is dead so there's even no way to download dependencies.
Note: Spiffy is outdated.
<plug>
Spiffy:
is written in Scala
uses the fantastic Akka library and actors to scale
uses servlet API 3.0 for asynchronous request handling
is modular (replacing components is straight forward)
uses DSLs to cut down on code where you don't want it
supports Scalate and Freemarker for templating
Spiffy is a web framework using Scala, Akka (a Scala actor implementation), and the Java Servlet 3.0 API. It makes use of the the async interface and aims to provide a massively parallel and scalable environment for web applications. Spiffy's various components are all based on the idea that they need to be independent minimalistic modules that do small amounts of work very quickly and hand off the request to the next component in the pipeline. After the last component is done processing the request it signals the servlet container by "completing" the request and sending it back to the client.
https://github.com/mardambey/spiffy
</plug>
You could also try Context. It was designed to be a Java-framework but I have successfully used it with Scala also without difficulties. It is a component based framework and has similar properties as Lift or Tapestry.
I have stumbled upon your question a few weeks back, but since then also learned about Circumflex. This is a nice, minimal framework that is therefore easy to learn, and it has pretty good documentation available as well.
Beside it's minimal-ness, it also claims to work well with other libraries and lets you use your own implementation of things when you need it.

Drawbacks to using Lift (Scala-based framework) for webservices?

I have been working on a project and as I have just started on the webservice I found Lift has been released, so I am curious if there will be much more complication by using Lift over Jax-WS using JDK6.
I am doing this with the Eclipse IDE, but I don't know if I will get much benefit from the IDE on this project.
Lift is written in Scala, so the simple question is do you know Scala? If you don't know Scala but you do know JAX-WS, then Lift will clearly be way more work to get to a working implementation.
Scala and Lift are cool, but unless you are already comfortable with functional programming approaches, they will make your head hurt for at least 6 months. Since they are relatively new they also suffer from a lack of tooling.
You mention that you are using JAX-WS - can you do that with Lift? If you can't do it natively with Lift, can you easily integrate the standard Java libraries for this?
Depending on whether this is a personal project or work-related, your tolerance for taking technical risk can vary widely.