Searching for best practices for render a page quickly after Request Handler redirect while triggering long-running processes
Hi Mendix Community, I am dealing with a UI/UX issue that I am hoping others have tacked before. At a high level, the issue is that a user is sent to a page that doesn't load right away because the redirect microflow also kicks off a number of processes that can take a second or two to complete. The goal is to render that page to the user and kick off the underlying processes in the background. The more detailed process: 1) The user enters our application using a request handler. 2) This request handler routes the user through the go home navigation microflow 3) This microflow has a step added to check if the incoming user has a pending 'transaction' 4) If they do have a pending transaction, we kick off another microflow that does a number of things: a) sends some confirmation emails b) completes setup of some underling master data c) generates a few documents that the user needs d) renders a confirmation page where they can view the data 5) The issue is that upon hitting the request handler, the user just sees a white screen if they have a transaction while all the above steps complete. Obviously this takes some time. What would be ideal is a way for the users to be sent to the confirmation page right away while things like sending the email and building the documents run concurrently in the background. It's not critical that the confirmation emails be sent or the documents be generated before the page is loaded. As long as those things happen within a few seconds of the page being rendered that would be fine. Has anyone dealt with this situation in the past? Some things I was considering: 1) having a scheduled event to run every second to check if there are transactions 'pending' that need to be completed. The navigation microflow can simply change the status of the transaction to Pending and render the page. The Scheduled event could kick off the processes in the background after it picks up the Pending transaction. 2) Rendering the page, then have the page be populated by a microflow. This microflow could check if the transaction was incomplete, then it could kick off the email/document steps, then set the transaction to 'complete' Has anyone tackled a similar type of situation in an app before? Is there something within Mendix that I am overlooking to render that page then kick off some other microflows? Thanks, Rob
Did you consider to run the microflow(s) asynchronously?