Make you server expose a remote control interface, i.e.

public interface IJobScheduler
{
        void Add(Job job);
        JobProgress GetProgress(Guid jobId)
};

public struct Job
{
        public Guid Id;
        // job contents
};

public struct JobProgress
{
        // whatever
};

Your server is probably stateful and you expose the remoting interface
by calling
        RemotingServices.Marshal(yourJobSchedulerInstance, theObjectUri,
typeof(IJobScheduler));
        
The client connects to the server and sends it one or more jobs. When
the server launches a process, it passes it thejob id. For now on,
there are many scenarios for the server to get a job progress after it
has launched a process to handle the job, here are two:

1) You have a database with a table similar to the one below, where
the processes write the job statuses:
JobStatusTable
        JobId   GUID
        Status  INT (or whatever)
        -- any extra fields you need

When the client calls GetProgress, you query the table and return a
progress object.

2) The processes, handling the jobs expose an interface, lets say IJobMonitor:

public interface IJobMonitor
{
        JobProgress GetProgress(Guid jobId);
};

Each time a process is launched to do a job, it is passed the job it,
the process exposes its IJobMonitor interface by publishing it via a
Uri like "ProcessJobMonitor_" + theJobId.
When the client calls GetProgress, the server attemtps to connect to
the IJobMonitor interface published at "ProcessJobMonitor_" + theJob
id and returns the job progress.

I think I've seen a pattern somewhere in Microsoft Patterns &
Practices - about async job scheduling or something like this, but
you'll have to google for it.

Hope that helps,
Stoyan


On 4/21/05, Dave Heizer <[EMAIL PROTECTED]> wrote:
> I have a situation where our insurance application will have several long
> running processes to do things such as generate bills, calculation of
> values, and many other non-trivial tasks for 100,000's of policies.  Some
> of these tasks may take hours to complete.
> 
> Obviously we want these processes handle on our application server and not
> a client desktop, but the client does need to "submit" the process when
> they are ready and will need some progress / completion information
> returned.
> 
> What approaches are most appropriate to handle such functions?
> 
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
> 
> View archives and manage your subscription(s) at http://discuss.develop.com
> 


-- 
Cheers,

Stoyan

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to