Repository navigation
fix: reverse a declined alternative without cancelling a missing order - #9
Merged
Merged
Conversation
An out-of-stock bike completed serviceTask_orderBike normally, so BPMN registered its compensation. Declining the alternative (or withdrawing while it was being clarified) then ran callActivity_cancelBikeOrder without an orderId and ended in an incident. - orderBike raises the BPMN error bikeUnavailable, caught by an interrupting boundary event that leads to the clarification task; gateway_bikeAvailable and the bikeAvailable variable are gone - the declined path sends the cancellation confirmation, so the application reaches CANCELLED - validateApplication is no longer a process step: a request without income is refused with a 400 when the application is received Refs miragon-blueprints/cibseven-remote-example#31
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
When the requested bike was out of stock,
serviceTask_orderBikecompleted normally withbikeAvailable = falseand noorderId. BPMN registers compensation for every completed activity, so when the back office then declined an alternative (alternativeFound = false) the order compensationcallActivity_cancelBikeOrderran with a missingorderId, the cancellation task failed and the instance ended in an incident;endEvent_contractCancelledwas never reached. The same happened when the customer withdrew whileuserTask_clarifyAlternativewas open. On top of that, nothing set the application toCANCELLEDon the declined path.Port of miragon-blueprints/cibseven-remote-example#31 (twin: miragon-blueprints/cibseven-process-engine-api-example#24). Issues are disabled in this repository, so there is no issue to close.
What
orderBike. New errorError_BikeUnavailable(bikeUnavailable) with an interrupting boundary eventevent_bikeUnavailableonserviceTask_orderBikeleading touserTask_clarifyAlternative.gateway_bikeAvailableand thebikeAvailablevariable are gone;orderBikeflows straight to the parallel join.OrderBikeUseCasereturns theOrderIdand throws the new domain exceptionBikeUnavailableException;OrderBikeWorkertranslates it intoBpmnErrorOccurredwith the generatedErrors.BIKE_UNAVAILABLEcode. A task left through an error registers no compensation.serviceTask_confirmContractCancellationbetweenevent_triggerReversalandendEvent_contractCancelled, reusing the existingsendCancellationConfirmationtopic. No new code.validateApplicationis no longer a process step. The task, its error boundary event,Error_ApplicationInvalid, the worker, use case, service andApplicationInvalidExceptionare removed. The income check moved intoLeasingApplication.receive, which throwsIllegalArgumentException; the existingGlobalExceptionConfigurationanswers it with a 400 problem detail.docs/assets/bike-leasing.pngre-exported.BikeUnavailableTransactionTestruns the out-of-stock order with the real services.08-alternative-declinedand09-invalid-request../mvnw -pl service/app generate-sources.Behaviour change to be aware of
monthlyNetIncome <= 0is now refused synchronously with400 Invalid requestand starts no process. Before, it was accepted with 200 and rejected by the process afterwards.bikeAvailableno longer exists; the model changed, so running instances of the old definition keep the old shape.@Transactional(noRollbackFor = ...)was deliberately not added toOrderBikeService:BikeUnavailableTransactionTestis green without it, because the@ProcessEngineWorkeris not transactional and the service's rolled-back transaction does not enclose the engine call that reports the BPMN error.How it was verified
./mvnw verifygreen locally (architecture, Checkstyle, unit, process, model validation, OpenAPI export;openapi/openapi.jsonunchanged).npm run lint:bpmnclean.