Token in Cockpit

If I only use Service Tasks in my BPMN, which implementation are Java Classes, I dont get Token in Cockpit, because it goes through in a second. Why isn’t the Token as long as the Java class is executed at the Service Task Activity ? So I can’t realtime monitor my process if only Service Tasks are used ? I know the workaround with timers or User Tasks where the token stops, but this isn’t a nice option for my need.

The below explains the behaviors when implementing service tasks with Java Classes - it differs for external tasks

Tokens are shown on wait-states
wait-states occur when the state has successfully been committed to the database.
Only after the java class has successfully finished running would it be possible to commit the state.
So it would not appear in cockpit while the tread it active and the code is running.

1 Like

As Niall suggested you should use async before property to create additional wait states before service task is executed. Please try marking the Service task with async before true. Then put some delay on your delegate code and you should see token while it is executed.

1 Like

So I should set in Modeller the Service Task at Properties Panel to Async before, like in this image:

And in my Java Code where my execute method is from delegation I have to add a delay ? Whats the code for that ?

That is right!

It is just for simulation so you can see the token while code is executing. If your code really takes sufficient time you don’t need to add anything otherwise you can use Thread.sleep for testing.

1 Like

Thanks this worked fine. One last question:

In Cockpit I see now the token while execution, but is the token “live changing” to next Task, because I didnt get him switching to next task after he ended the first task. Just with refreshing the browser via “F5” pressed. Or is it because the second task has ended to fast. (I tried with Thread.sleep just in first Service Task)

Yes, if service task executes fast you may not have a chance to see the token because it ends quickly.
Good to know it worked!

I did both Service Tasks in a row, configured in properties panel ‘asyn before’
I see token in first Service Task perfect (I added Thread.sleep(20000); in execute method of this delegate code). So I see the token at first Service Task. My suggestion is, that the token will switch after that 20 seconds to next Service Task (where I also added Thread.sleep(20000)) but it “runs through” till end. And my question is: Am I able to see the token is switching after first Task is ended to next Service Task in “realtime” while watching in Cockpit ? Or is it just possible to see Token on next Step/Service Task after I refreshed browser with pressing the button “f5” or refreshing.

No, real time animation of token is not provided. You have to refresh page to see latest location.

2 Likes

hello!
Is realtime token animation already available in the latest camunda cockpit? I’m using Camunda Platform 7.16 and still we have to refresh the page to see the latest location of the token. Is there a plan for including such feature?

This feature is available in Camunda 8, but not in Camunda 7.x