Inspiration
For a long time, I found it difficult to enqueue long-running background jobs in Java without generating extra load on my webserver serving end-users. You had to implement all kind of interfaces, scaling was not easy, monitoring these background jobs often required extra tooling, ... .
What it does
JobRunr allows you to enqueue a long-running background job using only a Java 8 lambda!
An example:
BackgroundJob.enqueue(() -> System.out.println("This can run on another server"));
Or
BackgroundJob.scheduleRecurringly(() -> System.out.println("This can run on another server"), daily());
When you enqueue a new job, JobRunr analyses your lambda and transforms it to readable Json which is stored either in a SQL or NoSQL database. You can create thousands of jobs and if processing takes too long, you can just scale horizontally - all the background job servers will take jobs of the queue and process them in parallel.
How I built it
It's built using standard Java 8 and I'm using the ASM library to analyse the bytecode of the actual job.
Challenges I ran into
I did not know a lot about the Java Virtual Machine Instruction set and analyzing the lambda so that it can be transformed to Json was not trivial. JobRunr also supports all kind of json libraries, incuding JSON-B, Jackson and Gson. Supporting all these libraries was not easy as they each have their advantages and drawbacks.
The difficult part to make JobRunr work on Quarkus is my use of the SerializedLambda which is not working in GraalVM. I do however have a workaround using a Quarkus Extension so that it runs on GraalVM.
Accomplishments that I'm proud of
Some end-users that reached out and are happily using JobRunr.
What's next for JobRunr
A lot of new features, including job chaining, ...!

Log in or sign up for Devpost to join the conversation.