Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Pages: [1]
Print
Author Topic: Async Macro Command  (Read 12194 times)
lulumOriss
Jr. Member
**
Posts: 14


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


View Profile WWW Email
« Reply #1 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.
Logged
philipSe
Sr. Member
****
Posts: 139


View Profile Email
« Reply #2 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
----Philip
Logged
lulumOriss
Jr. Member
**
Posts: 14


View Profile Email
« Reply #3 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.
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #4 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>
Logged
lulumOriss
Jr. Member
**
Posts: 14


View Profile Email
« Reply #5 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.
Logged
Tekool
Sr. Member
****
Posts: 192


View Profile WWW Email
« Reply #6 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.
Logged
Pages: [1]
Print