Services Endpoint Question

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Services Endpoint Question

Jack Ring
Please ignore last post - Wrong subject line.


Hello,

My Flex application is using ColdFusion Flash Remoting for remote object
access service. In each of my services I have my endpoints defined on
preInitializeService(); - Is there any way I can change the endpoint if a
call fails or times out?


Code from the service...

protected override function preInitializeService():void

{

    super.preInitializeService();

    // Initialization customization goes here

    super._serviceControl.source = "services.accountsService";

    super._serviceControl.endpoint = "
https://www.somewhere.com/flex2gateway/";

}


I am running ColdFusion 10,0,7,283649 on IIs 7.5 Win 2008 R2 64 bit and I
have many websites. Somehow only my somewhere.com domain keeps going down.


Thanks,

Jack Ring
Reply | Threaded
Open this post in threaded view
|

RE: Services Endpoint Question

David Coleman
in the case of a timeout, (not with cold fusion, but with a common HTTPService class accessing PHP services), I created a custom extension of the HTTPService class, that registers its own listeners on the IOError event.  on failure you can then preventDefault() to abort your external event handlers.  
Then you add a "failOverURL:String" to this custom class.  after all, each service may have different failover endpoints.
To handle timeout, first you define a CustomHTTPServiceEvent, which contains the const SERVICE_TIMEOUT:String = "serviceTimeout".  then you add the metadata to register this event to your new custom HTTPService class.  Then you can define an extra value for your class (or use a static to affect ALL services), which will specify the number of ms that you want to use for timeout.  let's say it is 90,000 ms (90 sec).  
Then you override send and start the timer when you invoke send - of course you must remember to call super.send(value);  Also, save in a protected class var, the params used to invoke super.send(...);
When the timer expires, you will execute a "cancel()" operation, and dispatch a "SERVICE_TIMEOUT" event, and in your case, change the endpoint to the fail-over url and send(savedParams) against the new endpoint.  REMEMBER to stop your timer.
Also remember to add other listeners to all other relevant events, and stop your timer when something succeeds too, or the class will re-send itself.
Cheers!Dave

> Date: Tue, 5 Feb 2013 08:23:20 -0500
> Subject: Services Endpoint Question
> From: [hidden email]
> To: [hidden email]
>
> Please ignore last post - Wrong subject line.
>
>
> Hello,
>
> My Flex application is using ColdFusion Flash Remoting for remote object
> access service. In each of my services I have my endpoints defined on
> preInitializeService(); - Is there any way I can change the endpoint if a
> call fails or times out?
>
>
> Code from the service...
>
> protected override function preInitializeService():void
>
> {
>
>     super.preInitializeService();
>
>     // Initialization customization goes here
>
>     super._serviceControl.source = "services.accountsService";
>
>     super._serviceControl.endpoint = "
> https://www.somewhere.com/flex2gateway/";
>
> }
>
>
> I am running ColdFusion 10,0,7,283649 on IIs 7.5 Win 2008 R2 64 bit and I
> have many websites. Somehow only my somewhere.com domain keeps going down.
>
>
> Thanks,
>
> Jack Ring