On second thought,

I should invoke the code in the RemoteObject's fault property with 
event.fault.fault(code|
string) set to timeout instead of definining a new event handler. With that 
said. How could 
I call the code in the fault property of the RemoteObject? I can't seem to find 
any 
documentation on this.

Todd


--- In [email protected], "charged2885" <[EMAIL PROTECTED]> wrote:
> Steven,
> 
> After attempting to implement this, I agree with you. 
> 
> My working implementation right now is different from what I posted. I 
> created a 
> ServiceCommand base class which all commands subclass if they access remote 
services. 
> In this base class, i implement Responder and Command. In the methods defined 
> by 
those 
> interfaces, i simply clear the time out timer. in onResult, an extra bit of 
> logic is used to 
see 
> if the call had been previously timed out and handles it accordingly. 
> Finally, I added the 
> onTimeOut method which accepts a call object as it's only argument. Here is 
> where I 
> broadcast a EVENT_TIME_OUT event.
> 
> After using this, I have determined that my implementation was not well 
> thought out. I 
> hadn't anticipated that I would like different timeouts for different 
> commands. I also 
would 
> like to handle timeouts differently for each command. Some commands need to 
> timeout 
> quietly while others need to be brought to the user's attention.
> 
> With that said, I too agree that this all should be logic of the 
> ServiceLocator. I can 
subclass 
> remote object and add a timeout property which will hold the timeout 
> function, a 
> timeoutTime property which defines the time out time in ms (with a default) 
> and finally 
the 
> maxtries property (with a default).
> 
> I was planning on releasing my implementation which also contains a custom 
> authentication implementation on my company's website under the same license 
> as 
> cairngorm. But in the mean time, I will post a working implementation here as 
> soon as I 
> am happy with it. I will spend the day moving my logic to the ServiceLocator 
> and report 
> back.
> 
> Thanks for your input. 
> 
> Todd
> 
> --- In [email protected], "Steven Webster" <[EMAIL PROTECTED]> wrote:
> > Hi Todd,
> > 
> > Glad to see you're taking a stab at this; John Bennett of Macromedia
> > Consulting implements a neat solution for handling timeouts in the
> > Macromedia Consulting framework that was announced recently on
> > www.macromedia.com/devnet/flex/
> > 
> > Personally, I think the handling of timeouts/retries etc, would best be
> > abstracted in the ServiceLocator; you would define on a service the policy
> > for timeout and retry, the business delegate would blindly invoke methods on
> > services, and the service locator would handle retries and timeouts on
> > behalf of the business delegate.  If the service failed catastrophically (ie
> > max retries/etc) then a fault could be passed back to the delegate (and the
> > commands if needs be).
> > 
> > The reason we didn't implement this ourselves in Cairngorm, was simply to
> > keep the framework simple for most people; but if you implement this scheme
> > in the ServiceLocator, I'd be keen for you to share your implementation with
> > us ?
> > 
> > I'd recommend pushing this functionality down into the ServiceLocator rather
> > than up into the Command ... Thoughts ?
> > 
> > Glad to see you thinking on this,
> > 
> > Best,
> > 
> > Steven 
> > 
> > -----Original Message-----
> > From: [email protected] [mailto:[EMAIL PROTECTED] On
> > Behalf Of charged2885
> > Sent: 08 June 2005 18:04
> > To: [email protected]
> > Subject: [flexcoders] Service Call Timeouts in Cairngorm
> > 
> > I'm seeking opinions on implementing service timeouts into a caingorm-based
> > application. 
> > here's what i'm thinking:
> > 
> > I will create a new interface called Timeout which defines a single method:
> > onTimeout. The Commands which implement the Responder interface must also
> > implement the Timeout interface. When the command is executed, i will set a
> > timer (in the execute method) which will be unset once the onResult or
> > onFault methods of the responder interface are called. if it is not unset in
> > say 5 seconds, an EVENT_TIMEOUT Event will be dispatched with the original
> > Event in the Event's data property.
> > 
> > how have others implemented this? if so, how does it compare?
> > 
> > i'm new to flex and actionscript so i'd love to hear some feedback.
> > 
> > todd
> > 
> > 
> > 
> > 
> >  
> > Yahoo! Groups Links




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to