Skip to content

Add the possibility to prevent concurrent processing of a SensoryEvent #469

@dfollen-ing

Description

@dfollen-ing

Hi

We have a case where a part of the recipe is repeatable. The same sensory event which has no firing limit (withSensoryEventNoFiringLimit(RepeatableSensoryEvent.class)) can be processed several times. This case happens for instance when you have gather consent from different actors and they can provide their consent concurrently.
The issue we face right now is that the context in which the sensory event is processed is unique for the recipe, meaning that any concurrent sensory event will impact the events and ingredients context.
Is it possible to add a functionality to mark a sensory event as non concurrent, (for instance withSensoryEventNoFiringLimitNonConcurrent(RepeatableSensoryEvent.class)). When the sensory event is received a (potential distributed) lock is being acquired. If the lock has already been acquired then the sensory event cannot be processed until the lock is released.

This could be implemented by creating a technical "lock token" (invisible to the recipe) that is needed with the sensory event. The token is then consumed when the sensory event is processed and re-generated when the recipe has finished processing the sensory event.
The next sensory event will only be processed when the "lock token" has been re-generated. This "lock token" would be generated at the creation of the recipe.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions