Achieving high throughput with SQS using Akka Streams

SQS (Amazon Simple Queue Service) is a managed queue service provided by Amazon. Since it offers high availability and a fully managed service, it is a good choice when you need to deal with queues and do not want to manage and maintain your own message broker. Its price is also very attractive since it costs only USD 0,40 per million requests. We have already talked about Akka Streams over here, specifically comparing it with Apache Camel, and, we already know it is a great tool to build reactive…

Keep reading

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