Migrating from Activiti 5.21 to Flowable 6.3.1

We are in process of migrating from Activiti version 5.21 to Flowable version 6.3.1. We use Shared-Engine / Multi-Schema data model for handling multi-tenancy in our application.
To support this model we have implemented our own TenantRoutingDataSource which returns the appropriate data source based on underlying tenant.
After migrating to Flowable things work fine for new deployments until “flowable5CompatibilityEnabled” attribute to “false” but as soon as we set “flowable5CompatibilityEnabled” attribute to “true”(to support old definitions and instances) the engine does not get build.

Problem - The commandExecutor.execute() call inside buildProcessEngine() API of ProcessEngineConfigurationImpl class tries to fetch data source even if at this point there is no tenant context in picture.

public ProcessEngine buildProcessEngine() {
ProcessEngineImpl processEngine = new ProcessEngineImpl(this);

    // trigger build of Flowable 5 Engine
    if (flowable5CompatibilityEnabled && flowable5CompatibilityHandler != null) {
        commandExecutor.execute(new Command<Void>() {
            public Void execute(CommandContext commandContext) {
                return null;


    return processEngine;

Is this expected behaviour? Why should there be any data source needed at this point?

How do I resolve the issue?