Reactive Programming

A Non-blocking “Email sending” functionality in Scala

Reading Time: < 1 minute In our last blog “Adding an Email Sending Functionality in Play using Scala” we explained how to include an Email sending functionality in a Play Scala Application. But the way in which we implemented it, made it a Blocking one i.e., application will wait until email has been sent. In this blog we will explain, how to make the Email Sending functionality a Non-blocking one. By making Continue Reading

Obtaining Geolocation in Play using IP Address

Reading Time: < 1 minute In this blog , I will explain how to obtain Geolocation in Play Scala application from IP address of user . You can easily fetch user’s current location or near by location by his IP address . 1) You will require API key to be able to use this feature. To get API key , just go to IPInfoDB . 2) Get user’s IP address var Continue Reading

Automated UI testing in a Play Scala Application using FluentLenium

Reading Time: 2 minutes In this blog I am going to demonstrate how to do Automated UI testing of a Play Scala application using FluentLenium. FluentLenium is a framework that helps to write Selenium tests. FluentLenium provides us a fluent interface to the Selenium Web Driver. FluentLenium allows us use the assertion framework we like, either jUnit assertions or Fest-assert. To start building testcases using FluentLenium follow the below steps: 1) Add following dependencies in build.sbt file. “org.seleniumhq.selenium” Continue Reading

Play Framework 2.2 with WebJars client-side web libraries

Reading Time: < 1 minute WebJars are client-side web libraries (e.g. jQuery & Bootstrap) packaged into JAR (Java Archive) files. WebJars can be added as dependencies to an app by simply adding them to the build.sbt file. There is also a helper library named webjars-play that makes it easy to reference WebJar assets. Here is an example build.sbt file with webjars-play and the bootstrap WebJar as dependencies. Do the following Continue Reading

Employee-Self-Service: Reactive and Non-Blocking Database Access using Play Framework and Anorm – (Part-4)

Reading Time: 2 minutes Last week, We have added Database Access as Reactive and Non-Blocking behaviour in Employee-Self-Service  application. Now we have added some more features. These are following: Achieving, Futures to use more idiomatic error handling. Replaced the embedded JS & CSS libraries with WebJars. Achieving, table pagination and sorting functionality. Before: def list() = Action.async { implicit request => val futureEmpList = scala.concurrent.Future { Employee.list } val timeoutFuture = Promise.timeout("Oops", Continue Reading

Mock Unit Testing using Mockito in Play Scala project

Reading Time: 2 minutes During Unit Testing in a Play Scala project, there arises a need to Mock certain Objects or Traits which are used in the unit, so that the unit being tested has a consistent interaction with its outside dependencies. But due to tight coupling or external dependencies, objects cannot be tested as a unit. So, we need to mock those external dependencies by adding fake external Continue Reading

Employee-Self-Service: Reactive and Non-Blocking Database Access using Play Framework and Anorm – (Part-3)

Reading Time: 1 minute Last week, We have added Reactive and Non-Blocking behaviour in Employee-Self-Service  application. Now we have implemented Database Access as Reactive and Non-Blocking: Before def list() = Action.async { implicit request => Employee.list match { case Right(data) => Promise.timeout(Ok(html.list(data)), 1 seconds) case Left(error) => Promise.timeout(Ok(html.list(Nil)), 1 seconds) } } After def list() = Action.async { implicit request => val futureEmpList = scala.concurrent.Future { Employee.list } val timeoutFuture = Promise.timeout(“Oops”, 10.second) Continue Reading

How to use Cookies in Play framework

Reading Time: 2 minutes Play framework is being used by every Scala developer now a days. In this post we’ll learn about using Cookies in Play framework. Play has a stateless architecture so in order to keep the data across multiple HTTP request we can use Session & Flash. But both Session & Flash loose data as soon as browser is closed. So, to retain data even after closing the browser, we Continue Reading

Monthly Scala News Letter – March 2014

Reading Time: < 1 minute We are back again with April 2014, Newsletter. Here is this Monthly Scala News letter – March 2014 In this news letter, you will find some new organizations which are adopting Scala, Akka in their daily project, some new books to become expert of Scala, Akka and a new way to convince your boss to use typesafe platform. So, if you haven’t subscribed to the Continue Reading