Hey Scott,
In this case - we pass the new user directly to our outsourced mailing list - with no waiting on the mvcall response.
We don't care if there is an error - cause nothing is dependent on the email getting entered.
And since we don't have to wait for the callvalue - we just keep going. Saves some amount of time.
Announcement
Collapse
No announcement yet.
MvASYNCHRONOUS -- Does anyone have an example
Collapse
X
-
Here is one of our examples. We have started to use this wherever possible LOVE IT!
This code adds an email to our mailing list company upon a new sign up to our service (orangemailer.co)
<MvASYNCHRONOUS>
<MvASSIGN NAME="l.crlf" VALUE="{ asciichar(13) $ asciichar(10) }">
<MvAssign name="grant_type" value="client_credentials">
...
<MvCAPTURE VARIABLE = "l.json">
<MvEval expr="{ '{
"emails":[
{
"email":"' $ email $ '",
"variables":{
"First_Name":"' $ firstname $ '",
"Last_Name":"' $ lastname $ '",
"name": "' $ fullname $ '"
}
}]
}' }">
</MvCapture>
<MvCall action="{ 'https://api.sendpulse.com/addressbooks/71832/emails' }" method="RAW" HEADERS="{ 'Authorization: Bearer ' $ l.theToken $ l.crlf }" CONTENT-TYPE="application/json" FIELDS="l.json" FLAGS="noparse">
</MvCall>
</MvASYNCHRONOUS>
Leave a comment:
-
I use mvasync for anything that might time out since the async process is, from what I've been told, a roughly 60 minute process done in the background. If I need to show progress I create a flat file that has whatever progress data I want and check for it if the user triggers a progress display. Important to know that mvasync won't work with store functions or anything like that unless you initialize the store environment, similar to how you'd need to init the store environment for mvprocessupload.
Leave a comment:
-
Originally posted by RayYates View PostA scheduled task module is not that difficult to write, but that would be overkill for my situation.
Leave a comment:
-
David, Thanks for the snippet. What is the use case? Or, what issue would this potentially solve or help?
Scott
Leave a comment:
-
Code:<MVASYNC> <MvIF EXPR = "{ NOT [ g.Module_Library_Utilities ].Initialize_Async_Environment( 'scheduled', 'STORE_CODE_HERE' ) }"> <MvFUNCTIONRETURN> </MvIF> ... </MvASYNC>
Leave a comment:
-
MvASYNCHRONOUS -- Does anyone have an example
If you have an example or recommendations on its usage, please share. I assume the Scheduled Task feature in Miva uses it in ScheduledTasks_Spawn_AsynchronousTask() in the LSK but alas this function is not included.
A scheduled task module is not that difficult to write, but that would be overkill for my situation.Tags: None
- 1 like
Leave a comment: