DSA Request Dispatcher

Topics: Mobile Client Software Factory
Sep 20, 2006 at 11:45 PM
originally posted by: khabf04

Hi all,
I have noticed that eventhough the RequestManger dispatches the requests, the WebServiceRequestDispatcher is called only after the calling object has completed its execution.

For example:

class A
{
public object X()
{
...
requestManager.dispatch(request);
return objectX;
}

EventSubscription("topic://ReturnDataset", Thread = ThreadOption.Publisher)
public void OnReturnData(object sender, EventArgs args)
{
if (args != null)
this.returnData = handler.Data; // where returnData is the public property of class A that returns an object.
}
}


class B
{
A a = this.workItem.get<Class A>("Class_A");
object c = a.X();
}

When I execute class B, no doubt a.X() invokes the X() method of class A, but the code executes the whole method and returns a null object. After which the control is transfered to class B and therefore the object c still is NULL. It is only after this execution is the control transfered to the WebServiceRequestDispatcher and finally the CallBackHandler fires the event captured by the OnReturnData event handler.

My question is to know if it is possible for the requestManager.dispatch() to execute first and thus the WebServiceRequestDispatcher and CallBackHandler before the return object statement is executed.

Thanks in advance,
Best regards.
/Abdul.
Sep 21, 2006 at 7:23 AM
originally posted by: m_a_madero

I think you would have to handle that using events instead of object c = a.X(). I mean throw an event from Object X's method OnReturnData and catchit in object B to update the variable object c and then you will have the value you want.
The DSA works Async so the requestManager.Dispath() the only starts another thread that will do the work and then returns.