Configuring Akka Transactions

Akka assumes a number of default settings, but it allows us to change these either programmatically or through the configuration file akka.conf. See the Akka documentation for details on how to specify or change the location of the configuration file.

We can programmatically change the settings on a per-transaction basis using a TransactionFactory. Let’s change some settings programmatically from Java and then from Scala.

Configuring Transactions in Java

We extended Atomic to implement transactions in Java. We can provide an optional constructor parameter of type TransactionFactory to change the transaction properties. For example, we can set a transaction as readonly to gain performance and prevent changes to ...

Get Programming Concurrency on the JVM now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.