TaskListener - recognize claim event

On Camunda 7.19, is it possible to recognize who fired the source event in a TaskListener?

I’m building an AssignmentListener similar to the official example

The problem with this approach is, it’s also notified whenever a user claims a task for themself. It don’t deem it a good UX if I claim a task and then get notified about my own action.

Can I somehow recognize that the assignment was triggered by a ‘claim’ and ignore the event?

Hi @marco_tanner,

I believe below snippet of code should return who fired the assignment event.

IdentityService identityService = delegateTask.getProcessEngineServices().getIdentityService();

if (identityService.getCurrentAuthentication() != null) {
	userId = identityService.getCurrentAuthentication().getUserId();	    	
}

Hi @hassang ,

that could indeed work, I hope my calling code location acts as the current user and not just “as the server”. I will try this and give feedback.

thank you for your time

Hi @marco_tanner,

I believe that as long as the authentication is enabled, and your calling code is from within a task listener which is a reaction to a human interaction (claim), then current authentication should exist.