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

Converting old Java Future to CompletableFuture

Many Java async libraries still do not support the CompletableFuture, so, sometimes you will need to handle the old Java Future. The problem is: it has no callback methods. You definatelly need to block to get a result and it really (REALLY) sucks. This post is basically to show an easy way to convert the old Future into the new CompletableFuture, without any libraries, with only plain Java. We know that the Java Future interface does not have any callback method, so, the easier way to check whenever the future…

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

Seven tips to be happy as a Java Developer (or at least less sad)

Most Java Developers still are trapped working in Banks. These developers cannot simply stop writing bureaucratic code. If you already identified yourself, unfortunately, this post isn't for you, I'm so sorry, you're completely lost, but don't worry, I'm pretty sure there's a special place in heaven for people like you. On the other hand, there are a few Java developers who could escape the agony of writing "enterprise" Java code and started writing Kotlin, Scala or even a non JVM language. If you are a developer like this…

Keep reading