This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
jyoung
Posts: 694 Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA
Post
by jyoung » Wed Apr 25, 2018 1:43 am
When using avExecuteAyncOperation what is the best way to handle server failure?
For example
Code: Select all
mthroutine name(avExecuteAsyncOperation) options(*REDEFINE)
case of_field(#OperationID.UpperCase)
when (= GET)
#Get.Execute officenumber(#VLFOfficeLookup.OfficeNumber) formalname(#CLOFN) countrycode(#VLFCountryLookup.CountryCode) pagenumber(#wk_PageNumber) pagesize(#wk_PageSize) sortby(#wk_SortBy) sortdirection(#wk_SortDirection) resultlist(#ListItems) recordcount(#wk_Count) status(#wk_Status)
when (= DOWNLOAD)
#Csv.Execute countrycode(#VLFCountryLookup.CountryCode) officenumber(#VLFOfficeLookup.OfficeNumber) formalname(#CLOFN)
when (= EMAIL)
#Email.Execute officenumber(#VLFOfficeLookup.OfficeNumber) formalname(#CLOFN) countrycode(#VLFCountryLookup.CountryCode) email(#Parameter1) status(#wk_Status)
endcase
endroutine
The GET can take some time to complete and can fail.
Whats the best way to handle the failure? Do I just subscribe to the failed event? Does it get called even though it is executed without async?
jyoung
Posts: 694 Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA
Post
by jyoung » Wed Apr 25, 2018 2:06 am
After a bit of experimentation, it looks like the Completed and Failed events still get fired when Execute is used vs ExecuteAsync.
So it seems I can use the Failed event to trap the failure and handle accordingly.
dannyoorburg
Posts: 177 Joined: Mon Jan 04, 2016 9:50 am
Location: Australia
Post
by dannyoorburg » Wed Apr 25, 2018 8:04 am
Hi Joe,
That's correct, they still fire.
Also there's the catch-all RequestFailed event on #SYS_WEB that fires for both Sync and Async.
Danny.