title: Using Spring transaction management in a Vertx application
body: <p>While writing a simple web-app POC I would like to benefit from both - <a href="http://vertx.io/" rel="nofollow noreferrer">Vertx</a> non-blocking, event-driven nature and <a href="https://spring.io/" rel="nofollow noreferrer">Spring</a> declarative transaction management.</p>
  
  <p>My application interacts with a relational DB so I need to manage transactions.
  The <a href="http://docs.spring.io/spring-framework/docs/4.2.x/spring-framework-reference/html/transaction.html#tx-decl-explained" rel="nofollow noreferrer">Spring Framework’s declarative transaction management</a> is made possible with Spring aspect-oriented programming. Naturally I would like to annotate my service layer with the <a href="http://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/transaction/annotation/Transactional.html" rel="nofollow noreferrer">@Transactional annotation</a>. So far so good, but now Vertx non-blocking nature kicks in. My DAO is running some blocking calls (DB queries) which I would like to run using <a href="http://vertx.io/docs/vertx-core/groovy/#worker_verticles" rel="nofollow noreferrer">vertx worker verticle</a> which is executed using a thread from the worker pool (won’t block any event loops).</p>
  
  <p>So as I imagine it I got 2 Vertx verticles managed as spring beans. One verticle running my service layer, communicating via <a href="http://vertx.io/docs/apidocs/io/vertx/core/eventbus/EventBus.html" rel="nofollow noreferrer">vertx event-bus</a> with my second (worker) verticle running my DAO blocking code.</p>
  
  <p>I'm wondering weather spring transaction should work well with this asynchronous flow. Is there any example for such working implementation (assuming this is a valid practice, is this?)?</p>
  
  <p>Searching the net I've found <a href="https://github.com/vert-x3/vertx-examples/tree/master/spring-examples/spring-example" rel="nofollow noreferrer">this</a> and <a href="http://www.javaadvent.com/2015/12/reactive-programming-with-vert-x.html" rel="nofollow noreferrer">that</a> but both don't demonstrate the use of Spring transactions.</p>
  
  <p>Any ideas/thoughts?</p>