I have system in Asp.Net MVC (.Net 4.5) divided into layers:
Thatsaid,let'sgetdowntotheproblem...
I'mtryingtocreateascreentosendemailsasynchronously(3emailsatthesametime,forexample),buttherewillbeabuttontocancelthesending,whichforcesmetoinformthecustomerinrealtime,whichemailshavealreadybeensent.
Seethestreambelow:
Atthistime,iftheuserclicksthecancelbutton,in-processemailsshouldbeabortedandthelastonedoesnotevenbegin.
Respectingthelayeredarchitecture,Iwouldliketodealwithallthebusinessrulesforsendingtheemailsinthelayeritselfforthis.ButIhavenotyetbeenabletofindasolutionwhereIcansendalistofViewLayerobjectstotheBusinessLayer,creatinganasynchronousprocesstherethatsendsitbacktotoViewLayertheresultofsendingeachemail(onebyoneasynchronously),andatanytimemakesitpossibletointerrupttheentireprocess.
Thatwouldbetheflow:
Allemailsaresenttothebusinesstier:
Thebusinesslayerstartsanasynchronousprocesstosendtheemails,andasitcompletesthesendingofeachemail,itrespondstothepreviewlayertheresult:
Atanytime,theclientcancancelthesubmission,sothepreviewlayersendsacancellationrequestforallthetasksthatarestillrunning:
1. You can send data in the opposite direction (from Business Layer ) to to View Layer ) from a single call?
2.
3. Is it possible to interrupt a task that is running on a lower layer?