Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

readme.md

Transactions Plugin

micro-transactions example apps

Handle transactions in a more fluid stream-like (&Java8 Style) fashion

Integer result = TransactionFlow.of(transactionTemplate, this::load)
   									.map(this::save)
   									.execute(10)
   									.get();

Inject in a preconfigured TransacitonFlow bean

private final TransactionFlow flow;
@Autowired
public MyService(TransactionFlow flow){
  this.flow = flow;
} 

The map and flatMap your heart out. All mapped / flatMapped functions will be executed in the scope of a transaction.

flow.map(this::nextAvailable)
   .map(this::updateStatus)
   .execute(id);

TransactionFlow is modelled on the Reader monad (eek!) - which allows for lazy evaluation and dependency injection (hurray!)

Dependency injection using the Reader monad in Java 8

To use

Maven Central

Simply add to the classpath

Maven

     <dependency>
        <groupId>com.aol.microservices</groupId>  
        <artifactId>micro-transactions</artifactId>
        <version>x.yz</version>
     </dependency>

Gradle

    compile 'com.aol.microservices:micro-transactions:x.yz'