Registering a custom job handler to the main process engine--without spring boot

So I am trying to understand the process of building a custom job handler that schedules an async job. Sprint boot examples have been posted on a different thread, but I’m actually trying to rip it apart and understand the line-by-line of how to register a custom job handler with the process engine, because in my primary application I have to operate without sprint boot (so anything using annotations or beans is going to result in me spending a lot of time to rip apart the underlying dependency stack regardless).

I’ve got this basic function in here, called via a Main() method in a console app, that I’m using to tinker around and understand the process of connecting to and configuring a process engine. Right now I’ve implemented the stand-alone configuration for the engine, but if I have to change it I just need to understand how it has to be adjusted. What i really need is to know what the code would be to attach my custom job hander to the process engine so I can use it during runtime.

Here’s my job handler:

public class CustomJobHandler implements JobHandler {
public static final String TYPE = “cutomJobType”;

public String getType() {
	return TYPE;

public void execute(JobEntity job, String configuration, VariableScope variableScope,CommandContext commandContext) {


And this is the class I wrote for actually connecting to the engine:

public class FlowableEngine {

public FlowableEngine() {}

public ProcessEngine buildEngine(String jdbcUrl, String userName, String password) {
	System.out.println("Creating flowable engine");
	ProcessEngineConfiguration config = ProcessEngineConfiguration.createStandaloneProcessEngineConfiguration();
	System.out.println("Created standalone config for engine construction");
	BasicDataSource datasource = new BasicDataSource();
	System.out.println("Set the configuration");
	ProcessEngine engine = config.buildProcessEngine();
	System.out.println("Created the engine");

	return engine;


The whole thing is run as a console app using this runner class (sub in connection strings for the params–I stipped them out with xxxx on purpose for obvious reasons):

public class FlowableRunner {

public static void main(String[] args) {
	FlowableEngine engine = new FlowableEngine();		
	ProcessEngine processEngine = engine.buildEngine("jdbc:oracle:thin:@xxx:xxx:xxx", "xxxx", "xxxxx");


I think it should be as simple as adding config.setCustomJobHandlers(Collections.singletonList(new CustomJobHandler())) to your buildEngine(...) method.

That was indeed as simple as it looked, though the added gotcha that I didn’t quite understand is that I had to cast the object to ProcessEngineConfigurationImpl in order to get access to the method I needed. Thanks.