Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring-zebee worker Spring application events. #396

Open
aoral-pcln opened this issue Apr 3, 2023 · 0 comments
Open

Spring-zebee worker Spring application events. #396

aoral-pcln opened this issue Apr 3, 2023 · 0 comments

Comments

@aoral-pcln
Copy link

In Camunda 7 we utilized Spring event listeners to feed our custom monitoring tooling. Camunda 8 and spring-zebee do not provide Spring application events. Our monitoring requirement is very simple. We want to log each worker execution ( Process name, Service task elementID , input variables, result variables, result exceptions.)

We can do it today by intercepting JobWorker annotations with Aspect.

@around("execution(* com.priceline..*(..)) && @annotation(jobWorker)")
public void aroundExecution(final ProceedingJoinPoint joinPoint, JobWorker jobWorker)
throws Throwable {

However we needed to define ActivatedJob argument in each worker to extract Service task elementId and process name. We want to keep our workers' contract simple with only required process variables. In other words, we don't want to use ActivatedJob in anywhere in our worker implementation.

Is it possible to add Spring events in JobHandlerInvokingSpringBeans?

Possible Solution

Inject ApplicationEventPublisher into JobHandlerInvokingSpringBeans.

Fire WorkerStarted, WorkerExecuted, WorkerFailed ApplicationEvents.

public class WorkerStarted extends ApplicationEvent {
private Object[] workerArgments;
private ActivatedJob activatedJob;

....

public class WorkerStarted extends ApplicationEvent {
private Object result;
private ActivatedJob activatedJob;

....

public class WorkerFailed extends ApplicationEvent {
private Exception exception; // any type of exception.
private ActivatedJob activatedJob;

....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant