Interceptors before starting workflows and activities

Is there any interceptor called before starting any activity and workflow?
I need to initialize some MDC variables for logging purpose.

Thanks and Regards
Saket

Yes, you can use an interceptor for this.

Java interceptor configuration.

Go interceptor configuration.

Hi Maxim,
I am using cadence.I am not seeing an option for that.

Do you mind giving an example of how we can use in cadence?
Thanks for the help.

I don’t think Cadence supports interceptors.

@maxim Are there any documentation or example for interceptors? I want to start using it in my extension for Quarkus

I don’t think there is any special documentation besides JavaDocs. Let us know if you have any specific questions.

We have a java sample for interceptors if that helps.

2 Likes

The link seems to be missing, couldn’t find activity interceptors in the latest master. Are these removed, if yes, what’s the alternative to intercept an activity? Also, is it possible to intercept only a particular activity based on some static condition?

Found it here sdk-java/temporal-sdk/src/main/java/io/temporal/common/interceptors/WorkerInterceptor.java at master · temporalio/sdk-java · GitHub
Is there any way to intercept only a particular activity, today isn’t possible to provide custom activityId.