identityService.setAuthenticatedUserId

I want to know range when I set a process starter, how to sign a statter is this process in processEngine, I can’t understand this . Thanks .

well I try my best to answer your question since it is very hard to understand you. If you set the authenticatedUserId inside a resource-finally block and then start the process and after that set the AuthenticatedUserId to null that process will get that user as the starter. if this doesn’t solve your problem, there is always the possibility of setting a process variable yourself with a String containing the userId which started the process.

thank you reply, i can show some code to explain my question:

   identityService.setAuthenticatedUserId(userId);
  runtimeService.createProcessInstanceBuilder()
      .processDefinitionKey(key)
     .start();

this code will set userId to this processInstance, but when have a multithread operate this method, identityService.setAuthenticatedUserId(userId); this userId will is same user?

yes it does set the same user since the authenticated user is the same. i suggest you keep the starter user with a process variable inside the process and set it. if you want to fully use idm then add users/groups and add spring security on top of it. that way you can start process and ask for the current user from spring security and set that user as starter. hope this helps.

thank you , this is very helpful to me.