Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Welcome, Guest. Please login or register.
October 19, 2017, 01:51:38 AM
Home Help Search Login Register
News: Please DM @puremvc on Twitter to gain forum access. Spambots are why we can't have nice things.
Pages: [1]
Print
Author Topic: Async Macro Command  (Read 5193 times)
lulumOriss
Jr. Member
**
Posts: 14


View Profile
« on: December 23, 2011, 02:39:19 AM »

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.
« Last Edit: December 23, 2011, 04:13:32 AM by lulumOriss » Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW
« Reply #1 on: December 23, 2011, 03:20:31 AM »

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.
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile
« Reply #2 on: December 23, 2011, 03:46:09 AM »

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
----Philip
Logged
lulumOriss
Jr. Member
**
Posts: 14


View Profile
« Reply #3 on: December 23, 2011, 04:24:27 AM »

@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.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW
« Reply #4 on: December 23, 2011, 08:44:27 AM »

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>
Logged
lulumOriss
Jr. Member
**
Posts: 14


View Profile
« Reply #5 on: December 23, 2011, 08:54:18 AM »

Uh, here's a thing I've never heard about. This is exactly what I need.
Thanks.

lulu.
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW
« Reply #6 on: December 23, 2011, 11:37:07 AM »

Exact I forget this one as I'm used to the JavaScript version which lacks the port of this utility.
Logged
Pages: [1]
Print
Jump to: