Create concurrent and distributed applications isn't a easy task, the Akka Tookit was created to bring the Actors power to JVM, currently SCALA or JAVA can be used as development language. Akka is responsible for delivery the infrastructure for concurrent, distributed and fault tolerant event driven applications, Akka emphasizes the asynchronous model, Akka can be deployed on servlet container, so it fits on SAP HANA Cloud, to complement the Akka toolkit, another tookit focused on REST services on top of Akka was created (Spray), with this is possible to expose the Akka Actors as Rest services for consumption. To demonstrate how we can use Scala + Akka + Spray on SAP HANA Cloud, I've created a simple application that implements a classical Word Count using Map/Reduce using Akka Actors.
The project can be cloned from my Github account: https://github.com/isaias/spray-hana
The build of project is based on SBT, for a simple definition it is like MAVEN and Ant.
To publish a WAR for deploy on SAP HANA Cloud just use the SBT Task package it will generate a WAR that can be deployed directly.
Some attention points:
Brief explanation about the Akka Actors of project:
A CountDownLatch was used to indicate when all words was reduced and are ready to get final result.
To run it using Jetty just use the task container:start at SBT, after open your browser and call http://localhost:8080 to get a index or http://localhost:8080/wordcount to get a result of a processing using Akka Actors. After executing wordcount we will get a output like bellow:
{
"youthful": 1,
"rage": 1,
"looks": 2,
"buriest": 1,
"decrease,": 1,
"ordering;": 1,
"sweet": 8,
"liquid": 1,
"used": 1,
"eye": 2,
"evident:": 1,
"spring,": 1,
"silvered": 1,
"joy:": 1,
"lend,": 1,
"comment.": 1,
"perfection": 1,
"plants": 1,
"widow": 2,
}
Final considerations:
Spray is also a great option to provide REST services for SAP UI5. For this application spray-routing was used because it is on top of spray-servlet that is indicated to run a Servlet Container.
What do you think about the use of another languages on SAP HANA Cloud?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
37 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |