Building microservices with Finatra and Slick

I've been away for a while and I've been playing with Finatra, so, I decided to write this post because I really enjoyed using it. Lately I've been using Scala a lot in my personal projects and even for testing my Java applications (it is much better than using JUnit, believe me), so, I also tried a few scala web frameworks out and I found out that Finatra is the easiest one (at least for me). First of all, what is Finatra? Well, it is a web framework created by…

Keep reading

Deploying and running Docker containers on Marathon

Last article I explained how you can build your Mesos infrastructure, so, from here I'd assume you have it working already. First of all, we are going to build a simple application. It is going to be a Java application running on a Docker container, but, you can deploy whatever you want. build.gradle buildscript { repositories { jcenter() } dependencies { classpath 'com.github.rholder:gradle-one-jar:1.0.4' } } apply plugin: 'java' apply plugin: 'gradle-one-jar' repositories { jcenter() } task uberJar(type: OneJar, dependsOn: build) { mainClass = 'hello.marathon.Main' archiveName = 'hello-marathon-all.jar' } dependencies { compile 'com.…

Keep reading

Building a Microservice Infrastructure using Mesos, Marathon and Zookeeper

This post will be the first of a "series" that I'm planning about an infrastructure for Microservices. First of all, a few concepts: According to their web site, Mesos is a distributed systems kernel. Mesos abstracts every machine resource of a cluster to build a "super computer", exposing it as an unique resource pool. Marathon, in the other hand, is a resource manager that runs on top of Mesos. Using Marathon you will be able to deploy containers and applications into a Mesos cluster. Zookeeper is…

Keep reading

The basic you should know before building your REST api

There is no recipe to build a REST api, but, there are a lot of good practices that could be followed, so, I gathered the most used and well accepted practices that you should know before building yours. Index Most commonly used HTTP methods GET POST PUT PATCH DELETE Most commonly used HTTP status Don't use verbs in the resource uri Always use JSON as the content-type Envelop your response Make client-side errors well explained in the response Support versioning, but avoid to use it Support async and callback operations…

Keep reading

Configuring multiple datasources using SpringBoot and Atomikos

Since I didn't find any article explaining how to use the auto configuration to configure Atomikos on SpringBoot, I decided to write this post. I hope it can be useful to someone. ;) Dependencies Assuming you are developing a web application and want to use Atomikos to provide distributed transactions over multiple datasources, you will need only two dependencies: def springBootVersion = 'YOUR_SPRING_BOOT_VERSION_HERE' compile group: 'org.springframework.boot', name: 'spring-boot-starter-jta-atomikos', version: springBootVersion compile group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springBootVersion The application.yml If you are using…

Keep reading