-
Notifications
You must be signed in to change notification settings - Fork 26
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
Async ExpressionHandler #39
Comments
Since Expression- and ScriptCondition are not exposed in the api (at the moment), I would extend the import * as elements from 'bpmn-elements';
class FlorianSequenceFlow extends elements.SequenceFlow {
getCondition() {
const condition = super.getCondition();
if (condition?.type !== 'expression') return condition;
const execute = condition.execute;
condition.execute = asyncExecute.bind(condition);
return condition;
function asyncExecute(message, callback) {
execute.call(condition, message, (executeErr, result) => {
if (executeErr) return callback(executeErr);
return Promise.resolve(result).then(r =>
callback ? callback(null, r) : result).catch(err =>
callback ? callback(err) : err);
});
}
}
} |
paed01
added a commit
that referenced
this issue
Feb 21, 2024
Thank you Pål - this solution sounds reasonable - i will try it out! |
Can I close this issue or are you still struggling? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello!
apparently I can extend the behaviour of an activity - but how to extend the behaviour of a SequenceFlow?
I try to use an ExpressionHandler with an asynchronous resolveExpression function, which is not allowed in the interface but could be solved easily by overwriting the ExpressionCondition.prototype.execute method as follows:
or is there any other mechanism to deal with an async ExpressionHandler?
Thank you!
Florian
The text was updated successfully, but these errors were encountered: