Can you make an async callback to the same handler multiple times?

Can you make an async callback to the same handler multiple times?

Old forum URL: forums.lhotka.net/forums/t/7282.aspx


Jack posted on Wednesday, July 15, 2009

I was wondering if the async commands could be extended such that you could pass in two callback handlers.  One for a progress update and another for the final result. 

Somehow that seems too easy but then the remote DataPortal could be coded to do things in steps and return a progress indicator that the UI could handle to update the UI progress.

thanks

jack

ajj3085 replied on Thursday, July 16, 2009

The problem with reporting progress back is that it would require the server to open a connection to the client while the processing is occuring. That's not trivial. Probalby your best bet is to store the progress in the database somewhere, and have a command object which is used periodically to fetch that progress.

Jack replied on Thursday, July 16, 2009

I thought the callback handler provided that. I guess my question is really
is that a one time use?

public void DoSomething(arg1, asyncHandler,object>)
progressCallBack, DataPortalResult,object> dpCallback) can the
server make the call back to progressCallBack more than once?

DoSomething(arg1, (o,e) => updateStaus(e), (o2,e2) =>
actionCompleted(o2,e2));

Could I make a call like:

void DoSomething(arg1, asyncHandler,object> progressCallBack1,
asyncHandler,object>
progressCallBack2,
asyncHandler,object>
progressCallBack3,
asyncHandler,object>
progressCallBack4,
DataPortalResult dpCallback)

DoSomething(arg1, (o,e)=>updateUI(e),
(o2,e2)=>updateUI(e),
(o3,e3)=>updateUI(e),
(o4,e4)=>updateUI(e),
(o5,e5)=>callbackFinal(o5,e5));

I guess the question really boils down to:

1) Can you have multiple callbacks and/or can you call one more than once?
I thought the callback was the connection back to the client.

Thanks

jack


-----Original Message-----
From: ajj3085 [mailto:cslanet@lhotka.net]
Sent: July-16-09 6:58 AM
To: jaddington@alexandergracie.com
Subject: Re: [CSLA .NET] Can you make an async callback to the same handler
multiple times?

The problem with reporting progress back is that it would require the server
to open a connection to the client while the processing is occuring. That's
not trivial. Probalby your best bet is to store the progress in the
database somewhere, and have a command object which is used periodically to
fetch that progress.

Copyright (c) Marimer LLC