Repository navigation
Conversation
Introduce TaskHandlerInterceptor, TaskHandlerInterceptorContext and TaskHandlerInterceptorChain in the Spring-free core so cross-cutting concerns (logging, tracing, audit) can wrap every task delivery for both registration paths (@ProcessEngineWorker and manual subscribe). AbstractTaskSubscriptionApiImpl optionally wraps the subscription action in an InterceptingTaskHandler; an empty interceptor list keeps the current behaviour unchanged. Refs #278
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #313 +/- ##
=============================================
+ Coverage 50.65% 53.86% +3.20%
- Complexity 80 104 +24
=============================================
Files 40 45 +5
Lines 458 505 +47
Branches 9 11 +2
=============================================
+ Hits 232 272 +40
- Misses 221 226 +5
- Partials 5 7 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Interceptors receive a TaskHandlerOutcome from chain.proceed(), so a handler that fails the task or completes it by BPMN error itself is no longer seen as a normal return. Adds ACTIVITY_INSTANCE_ID as meta key. Refs #278
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Illustrates the interceptor idea for issue #278: cross-cutting concerns (logging, tracing, audit) around every service-task execution, for both registration paths —
@ProcessEngineWorker(worker-lib) and manualTaskSubscriptionApi.subscribeForTask(...)— without bean-replacement or AOP.This is Phase 1 only (the Spring-free core). Draft to make the concept tangible for discussion.
What
New Spring-free core types (
api,dev.bpmcrafters.processengineapi.task,@since 1.7):TaskHandlerInterceptor—intercept(context, chain)TaskHandlerInterceptorContext— immutable (taskInformation,payload,taskDescriptionKey,taskType)TaskHandlerInterceptorChain—proceed()api-impl:InterceptingTaskHandlerwraps aTaskHandlerin a recursive chain (delegate runs last).AbstractTaskSubscriptionApiImplgains an optionalinterceptors: List<TaskHandlerInterceptor> = emptyList()(@JvmOverloads) and wrapscmd.actiononly when interceptors are present — empty list = unchanged behaviour, zero overhead.Design notes
TaskHandlerInterceptor(notServiceTaskInterceptor) — it intercepts theTaskHandlerof a subscription and applies toEXTERNALandUSERalike; theTaskTypeis in the context for filtering.Not in this PR
ObjectProvider<TaskHandlerInterceptor>(orderedStream()), one PR per adapter repo, after anapirelease.process-engine-workerneeds no code change (goes throughsubscribeForTask), just a doc note.Verification
./mvnw clean verifygreen; new unit tests cover ordering, context content, skippedproceed(), and exception propagation.