Hi,
My data service call after the session time out for about 30 mins, does not get trapped into the fault handler. It pops up a Flash player error on the AIR simulator. I have some code to handle for session timeout error in the faulthandler. My server returns an exception for session timeout. My server log shows that it returns the exception, but it does not return to fault handler, instead throws a fault error on the UI in form of popup. I am using RTMP channel with below configuration.
<channel-definition id="mobility-rtmp" class="mx.messaging.channels.RTMPChannel"> <endpoint url="rtmp://{server.name}:@flex.rtmp.port@" class="flex.messaging.endpoints.RTMPEndpoint"/> <properties> <idle-timeout-minutes>20</idle-timeout-minutes> </properties> </channel-definition>
<flex-client>
<timeout-minutes>5</timeout-minutes>
</flex-client>
Please let me know how I can handle this.
Thanks,
Swathi.
Hi Ashish,
Thank you for the response. I am having this issue only on session time out or server down scenario. Here is how my code looks like.
Here is part of code from my service class, the dataservice is injected.
[Inject]
public var customdataservice:CustomDataService;
private var syncFillData():void
{
var asyncToken:AsyncToken = customdataservice.synchronizeFill(buildRemoteQuery()); asyncToken.addResponder(new AsyncResponder(syncFillResult, syncFillFault)); return asyncToken; }
private function syncFillFault(fault:FaultEvent, token:Object):void
{
// do some session time out handling here based on the error message
}
private function syncFillResult(result:ResultEvent, token:Object):void
{
// syncfill service call successfull
}
MyCustomDataService extends the BaseDataService class, like below
public class CustomDataService extends BaseDataService
{
public function CustomDataService()
{
super("CustomService", "CustomCache");
offlineAdapter = new CustomOfflineAdapter();
}
}
Here is the code for BaseDataService.
public class BaseDataService extends DataService private var _connectionModel:ConnectionModel; public function get connectionModel():ConnectionModel [Inject]
{
{
return _connectionModel;
}
public function set connectionModel(value:ConnectionModel):void
{
_connectionModel = value;
this.channelSet = connectionModel.channelSet;
}
public function BaseDataService(destination:String,cacheID:String="MobilityCache")
{
trace("Constructor BaseDataService destination=" + destination);
super(destination);
this.cacheID = cacheID;
autoSaveCache = true;
autoConnect = true;
autoCommit = false;
encryptLocalCache=true;
fallBackToLocalFill = true;
requestTimeout = 20;
}
}
We are using robotlegs for dependency injection.
Please let me know for any other questions.
Thanks,
Swathi.
Hi
Sorry for the delayed response - I was out of office for the last week.
Where you have instantiated your DataService (customdataservice variable), you should add an event handler for the fault event like this:
customdataservice.addEventListener("fault", faultHandler);
where faultHandler is the function you want called on a fault happening.
For more information, see here:
Regards,
Ashish Vashisht
North America
Europe, Middle East and Africa
Asia Pacific