JobRunr Pro

Transaction plugin

Enjoy support for @Transactional out of the box in your preferred development framework

The JobRunr Spring Boot Starter, Micronaut integration, Quarkus extension come with an @Transactional plugin that makes sure your jobs join the transaction created by the framework. You can also benefit from this plugin when using Kotlin with the Exposed ORM.

@Inject
private UserRepository userRepositoy;
@Inject
private JobScheduler jobScheduler;

@Transactional
public void createUserAndSendWelcomeEmail(User user) {
    userRepositoy.save(user);
    jobScheduler.<UserService>enqueue(x -> x.sendWelcomeEmail(user.id));
}

Thanks to the @Transactional support, the whole method - including the job scheduling - is transactional.

Also works with Exposed’s transaction block!

How does it work?

  • the JobRunr Spring Boot Starter and Micronaut Integration, Quarkus Extension, Exposed Plugin check whether they can participate in a transaction created by that framework.
  • if one is present, it is used and the whole method is transactional.
  • if not, JobRunr creates it’s own transaction to make sure the job is saved to the database.

This of course only works for the SQL StorageProviders.