REST API, WebSocket and ZeroMQ in Scala. What to use? - scala

Let's say I have some service that talks over ZeroMQ sockets, and I want to provide access to that service to a single-page web application. I'd like the web app to talk to a service that provides a REST API (for control and queries) and WebSockets (for monitoring), and which does this by talking ZeroMQ to the first service. I'd like to write this in Scala.
What options are available to me for building that second service?

A very integrated solution would be to use Akka/Play2 for this.
Akka would be the core component talking to the ZeroMQ socktes via akkas ZeroMQ Module, which gives you a nice Scala-API and Akka/Actor integration. This Akka/Actor system can than be accessed via HTTP/WebSockets by using either play-mini or play2 which mainly differ in the style of defining HTTP endpoints.

For REST API I would recommend Spray - a nice library with a very concise and flexible DSL for defining web services. We've integrated Spray into our current project and are pretty happy with it. As for play-mini, AFAIK, it depends on the entire play2 project, so you'll end up with a lot of stuff you don't need.

Related

Is there Alpakka SOAP support?

I have an application written in Scala/Akka and trying to add SOAP support. Anyone did it with Alpakka? Or what is the best way to do it. So far I think Camel is the best solution.
Currently, Alpakka does not support SOAP, but there is an open ticket. Your best bet is probably to use Camel integration in your Scala/Akka project. To that end, take a look at the streamz project or the Camel integration module in Akka (the latter is deprecated but may serve your needs).
There is also a library that provides some SOAP integration with Play.

Need help getting started with making REST services using GAE

I've just started on a small project to create some REST services using Google App Engine and Java. I'm new to both technologies, but I've done some reading on both. I'm familiar with SOAP (have used them previously), and I think I understand the conceptual differences between REST and SOAP.
Currently I need info regarding two things:
1) I'm trying to find some tutorial which builds a simple REST service from scratch for deploying on Google App Engine (GAE). The simpler the better, but it should have at least a few routing options. I don't need any UI, if that matters.
2) Which RESTful Framework should I use with Google App Engine. Again, simplicity is what I'd like, and something which has tutorials and a newcomer can easily grasp.
My ultimate goal is to just write a REST wrapper with multiple routing options, which eventual consumes some pre-existing SOAP services and returns their results.
Have you checked out Google Cloud Endpoints for creating a REST service? Its pretty simple and straightforward, also has support for OAuth.
I would give Jello framework a try. It offers a clean, and simple to follow, JSON format and provides a very powerful and comprehensive RESTful implementation that follows the OData specification.
Here is Jello's REST development guide: http://jello-framework.com/guide/rest.html

Experiences comsuming REST-ful services in Grails 2.3?

We are about to take on a large project implemented in Grails (2.3.7). The application makes heavy use of many different (end-points as well) REST-ful webservices. We are of course interested in using what is considered to be "best standards" (at least currently).
We are currently considering:
- Using the Groovy HTTP-builder
- Using the "REST Client builder" plugin
Any other we should consider and what are your experiences using the above mentioned?
I have used both http://grails.org/plugin/rest and http://grails.org/plugin/rest-client-builder and both provide a nice wrapper around HTTP Builder library. The "rest" plugin provides dynamic methods for you if you like using that syntax. I prefer REST client builder though. Both are easy to work with.

Can dart script call GWT's RemoteServiceServlet

I have a Dart project want to reuse the existing GWT service (RemoteServiceServlet), any way can do this?
There is no special support for GWT-RPC included in Dart and there seem to be no 3rd-Party apps available that provide this functionality.
This question is similar (but not Dart)
GWT Data Serialization
If you're feeling ambitious, you can write a Dart client that understand the GWT-RPC wire-protocol and use that to communicate. This is likely to be a great deal of work however.
I had a similar situation where I needed to access GWT-RPC Services from a non-GWT client (it was JavaScript, not Dart, but the same concept applies). Instead of accessing the GWT-RPC service directly, I ended up using jsonrpc4j to setup a JSON-RPC service alongside GWT-RPC. I was able to point jsonrpc4j at the GWT services to use, so there was no code duplication, just the extra code needed to wire up the JSON-RPC.
Then you will need a Dart JSON-RPC client, of which there are a few available: jsonrpc, jsonrpc2.
This all assumes that you have access to the GWT server and can setup the JSON-RPC service.

How to create a scala based service daemon which can be called by a web app?

How could I write a service in scala such that a web application would be able to call out to its endpoints?
How would it run as a daemon?
You could use Lift to build a REST-style web service. The Lift wiki explains it quite well.
You should take a look at BlueEyes and Scalatra if all you want is an efficient/scalable RESTful service, without the extra bells and whistles that Lift gives you.