http

Alpakka (Akka Streams) vs Apache Camel: who wins?

Most software engineers have to work with enterprise integrations, and, since we are all lazy, we love to use stuff that provide things out-of-the-box. Before I start, I have to say: I already have worked with both Camel and Alpakka, so, I'll try to make the fairest comparison I can. Apache Camel is a "lightweight ESB" and has been around for sometime now. It is widely adopted and battle-tested on production at many companies, like Cisco, Netflix and JPMorgan. On the other hand, the Alpakka project is relatively…

Keep reading

Building unknown sized streams in Scala

Maybe you've already run into a scenario that you needed to create a finite stream of something that you have no idea about the size of it: a queue, a paged HTTP service, a database table, etc. Luckly for us, both Play! and Akka Stream provide an easy way to create and to handle this kind of stream. Consider you have the following function: def fetchTransactions(page: Int): Future[Seq[Transaction]] = //implementation here You need, somehow, build a report of transactions. There are A LOT of transactions and your machine…

Keep reading

Best practices to design APIs with AMQP

As we all know, there's this hype around microservices that we cannot ignore. It is true, developing microservices help us decouple our systems, test and work with them better. Besides HTTP, you can create APIs with tons of other protocols and content types. Here is where I tell you a little experience about creating APIs with AMQP, using RabbitMQ (or any other message broker that supports AMQP 0.9.1). First, there are a few concepts that you must understand, before we continue to create our apis, but, if you…

Keep reading

Building microservices with Akka HTTP and MongoDB

It's been a while since my last post, but, here I am again. You probably know that both Akka HTTP and MongoDB Scala Driver are reactive, so, they're a good way to go when we talk about highly scalable microservices, and, since I've playing with both lately, I guess it's fair to show a simple REST application using them. Also, this example uses Fongo, a fake in memory MongoDB written in Java, to help us create our tests and not worry with our database access. Well, let's start then. build.…

Keep reading

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