PureMVC Architects Lounge

PureMVC Manifold => Standard Version => Topic started by: lulumOriss on December 23, 2011, 02:39:19



Title: Async Macro Command
Post by: lulumOriss on December 23, 2011, 02:39:19
Hi,

I would like to know the best practice to set the following issue:

How can I create an async macro command which will execute a task list, each one needing values from the previous one?
i.e., I store data in a remote database which returns the id of the last row. After what, I store this id in my local database.
I've thought storing each temporary data in a proxy but I'm not sure it's a good idea.

Thanks. lulu.


Title: Re: Async Macro Command
Post by: Tekool on December 23, 2011, 03:20:31
A good way of doing this is to use a Proxy which take commands name into parameters and execute them sequentially. It is the responsability of the command to call the proxy the right way to tell it to execute the next command in the list when the result is received from the server.A PureMVC extension to do this automatically would probably be a good idea. So I think that your idea of handling it within a proxy which temporarily stores server VOs is the good way of handling it.


Title: Re: Async Macro Command
Post by: philipSe on December 23, 2011, 03:46:09
If each task is a retrieval from the remote database, then the Loadup utility might be applicable.  Loadup allows you to specify a set of dependent retrievals and then say 'loadResources' and it takes care of the dependencies.  Each task is a separate proxy instance (whether of different proxy classes or same proxy class), and the proxy (or proxies) must implement the ILoadupProxy interface.

See http://trac.puremvc.org/Utility_AS3_Loadup (http://trac.puremvc.org/Utility_AS3_Loadup)
----Philip


Title: Re: Async Macro Command
Post by: lulumOriss on December 23, 2011, 04:24:27
@Tek: In my MVC understanding, I consider Proxies as a storage object with limited actions. I'm going to watch this way out.

@phillipSe: I'm not sure to understand the Loadup utility but I saw this issue as a generic mechanism, which can execute various tasks.

Thanks both.
lulu.


Title: Re: Async Macro Command
Post by: puremvc on December 23, 2011, 08:44:27
Look at the AsyncCommand utility. And note that the initial notification that is passed to the AsyncMacroCommand may be modified as it is passed from sub command to sub command.

-=Cliff>


Title: Re: Async Macro Command
Post by: lulumOriss on December 23, 2011, 08:54:18
Uh, here's a thing I've never heard about. This is exactly what I need.
Thanks.

lulu.


Title: Re: Async Macro Command
Post by: Tekool on December 23, 2011, 11:37:07
Exact I forget this one as I'm used to the JavaScript version which lacks the port of this utility.