[Arp] Multiple Service calls - best way to handle
Keith Takayesu
ktakayesu at bank-banque-canada.ca
Fri Mar 10 07:42:21 PST 2006
Thanks for everyone's response. I definitely have a couple of places
where I need to chain commands/service calls, so I will check out the
SequenceCommand, assuming thatI can adopt it to my MX.Forms project.
However, in this particular case, I don't need to wait for one before
the other comes back. I can simultaneously send out all the calls, then
just wait until all of them have been completed (or not, since I plan on
implementing Christophe's ModelLocator that has the views responding to
changes). Also, there are a couple of cases where I will be calling out
to services on different servers, and this must be done at the client
side, not the server.
What I am trying now is a simple approach (at least I think it is). The
command builds a list of services to be fired and stores it in the
model. As each service completes, the Delegate stores the response,
removes it from the list and fires the command's responder. The
responder can chose to check to see if this list is empty and decide if
it wants to go back to the viewRef or simply let the Model subscribers
do their own thing.
This way, the command's responder doesn't care which services have
completed or not. In fact, it appears to be impossible for it to
determine which service just responded. I say this because there doesn't
appear to be any of this information in my ResultEvent object.
Blue Skies,
Keith
-----Original Message-----
From: Arp-bounces at ariaware.com [mailto:Arp-bounces at ariaware.com] On
Behalf Of Brian Riley
Sent: March 10, 2006 10:23 AM
To: Arp at ariaware.com
Subject: Re: [Arp] Multiple Service calls - best way to handle
Keith:
I've had to do this many times, and have gone about it several ways. You
could:
1. Leverage the SequenceCommand object from the Cairngorm framework
-- while the framework was cerated for Flex, you can easily extend the
AS objects to do what you need -- the SequenceCommand object enables a
single user gesture to chain several commands together; they're linked
together such that one fires upon completion of it's predecessor.
Cairngorm <http://www.iterationtwo.com/open_source_cairngorm.html>
2. You can create your own utility for commands that loops through
an array of commands and executes each upon completion of the previous
one -- this allows a bit more granular control than the SequenceCommand
-- you can broadcast additional events that allow you to show a data
preloader, etc.
3. You can also create a new service call on the server that
encapsulates all the service calls and returns a result with a list of
your items -- not a fan of this, but I have seen it done. This forces
unique services just for your RIA.
best of luck,
-riley
ze.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ariaware.com/pipermail/arp_ariaware.com/attachments/20060310/db764b45/attachment-0001.htm
More information about the Arp
mailing list