Announcement

Collapse
No announcement yet.

MvASYNCHRONOUS -- Does anyone have an example

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • wmgilligan
    replied
    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.

    Leave a comment:


  • ids
    replied
    Hey Bill,

    What issue does it solve or make easier?

    Scott

    Leave a comment:


  • wmgilligan
    replied
    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:


  • Scot - ScotsScripts.com
    replied
    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:


  • ILoveHostasaurus
    replied
    Originally posted by RayYates View Post
    A scheduled task module is not that difficult to write, but that would be overkill for my situation.
    Having it in that location can have other benefit though. We or a store operator may have reason to want to temporarily disable scheduled tasks, and turning them off is quite easy in the Scheduled Tasks location, vs a module firing its own and possibly creating an unexpected event. Scheduled Tasks also have useful logging.

    Leave a comment:


  • ids
    replied
    David, Thanks for the snippet. What is the use case? Or, what issue would this potentially solve or help?

    Scott

    Leave a comment:


  • dcarver
    replied
    Code:
    <MVASYNC>
        <MvIF EXPR = "{ NOT [ g.Module_Library_Utilities ].Initialize_Async_Environment( 'scheduled', 'STORE_CODE_HERE' ) }">
            <MvFUNCTIONRETURN>
        </MvIF>
    
        ...
    </MvASYNC>

    Leave a comment:


  • RayYates
    started a topic MvASYNCHRONOUS -- Does anyone have an example

    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.
Working...
X