Custom idGenerator (for userTasks)

Hi

I want to prefix all ids used by camunda with the engine name (I collect tasks from different engines in a separate app and need the engine name for back navigation).

I use a processEnginePlugin to overwrite the idGenerator in postInit() like this:

@Override
  public void postInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
    final IdGenerator idGenerator = processEngineConfiguration.getIdGenerator();

    processEngineConfiguration.setIdGenerator(() -> applicationName + "-" + idGenerator.getNextId());

  }

but this seems to have no impact on the taskId.

Ideas?

Jan

PS: merry christmas!

Hi Jan,

I think it’s not possible to replace the Id generator in postInit because the generator is already injected - see ProcessEngineConfigurationImpl. Can you replace the generator in preInit?

Best regards,
Philipp

1 Like

OK, thanks, will give it a try … my idea was not to interfere with the camunda init and just decorate the configured generator. The “init()” block in ProcessEngineConfigurationImpl is really something …