Closed avernet closed 1 month ago
We discussed a few options:
send()
with propertiesThe last option is the one we are following. But for this to work, we need to change the implementation of runProcess()
to return a Future
or IO
.
def runProcess(
scope: String,
process: String,
initialTry: Try[Any] = Success(())
): Either[Try[Any], IO[Any]]
This in turn means making changes to the AsynchronousSubmissionManager
.
What brought our attention to this was that when publishing from Form Builder, we used to save then publish, but now saving happens in parallel to publishing. This is done in
builder/form/model.xml
. When we get thefb-publish-form
event, firstfr:run-process-by-name('oxf.fr.detail.process', 'save')
runs, then<xf:send submission="fb-publish-submission">
. These two operations run in parallel becausefr:run-process-by-name()
is now asynchronous.Instead of running the
save
process directly, we considered running another process that runssave
then dispatches an event back to the model. When we get that event, we would run<xf:send submission="fb-publish-submission">
. The problem is that we need context. We could save it in an instance, as we don't expect multiple publish operations to run concurrently, but this adds complexity.We would also need to do something similar in other places (and there may be more):
before-publish
before publishing.I'd like to avoid adding complexity in multiple places, making the code more error-prone and harder to maintain:
fr:run-process-by-name()
and replace it with an XForms action. This action, similar to<xf:send>
, would be asynchronous but behave synchronously. But what would that action be? We wouldn't want to use<xxf:run-process-by-name>
because processes are at the Form Runner level.<xf:action type="xpath">
level? For example, checking if the expression returns a future, and if so, running the subsequent actions only after the future is resolved. If we can do this, we'll avoid changing our XForms code, potential issues with customers usingfr:run-process-by-name()
, and this mechanism might be useful in the future when calling other async functions.+1 from customer