Search code examples
lagom

Best way to handle a synchronous call


Say your ReadProcessor needs to insert records using JDBC, or you need to integrate with a SOAP layer via a JAXWS call.

What is the best way to handle synchronous calls using Lagom asynchronous (by design) platform.


Solution

  • In contrast to vert.x, which provide dedicated possibilities to handle blocking calls, Lagom seems not to provide such an integrated feature.

    According to their documentation (exemplarily for JDBC), one has to create own handling mechanisms, which internally create threads to run on.

    So, the answer would be "do it yourself": create executors, runnables/callables and play with Futures to create an own non-blocking wrapper around your blocking calls.