Windows service design question

D

deko

I'm trying to finalize a windows service design any would appreciate any
comments - I'm new to windows services.

Essentially my UI app relies on a service to schedule IO tasks. The service
does nothing but keep track of elapsed time.

The reason I need a service is because the IO tasks are login agnostic. It
doesn't matter if anyone, or no one, is logged in. The IO tasks are defined
in the UI.

When the service starts, it reads from an xml file to get initial values for
its counters (a series of integer ProjectIDs and TimeSpan values). If
during the current system session, the elapsed System Uptime exceeds any of
the service's counters, IO tasks need to be run.

The catch is that the business logic required to run these IO tasks is
contained in the UI app. Each service counter consists of a ProjectID and a
TimeSpan: the Project corresponding to the ProjectID is defined in the UI,
and the TimeSpan value is a ticking count based on System Uptime, maintained
by the service.

How can the service interact with the UI app to utilize business logic in
the UI app?

Can I initialize an object in the UI app from the service?

How can I pass the service's TimeSpan to the UI app?

Can the UI app access the service's TimeSpan value at any given point?

Must I use remoting?

Other options?
 
W

Willy Denoyette [MVP]

| I'm trying to finalize a windows service design any would appreciate any
| comments - I'm new to windows services.
|
| Essentially my UI app relies on a service to schedule IO tasks. The
service
| does nothing but keep track of elapsed time.
|
| The reason I need a service is because the IO tasks are login agnostic.
It
| doesn't matter if anyone, or no one, is logged in. The IO tasks are
defined
| in the UI.
|
| When the service starts, it reads from an xml file to get initial values
for
| its counters (a series of integer ProjectIDs and TimeSpan values). If
| during the current system session, the elapsed System Uptime exceeds any
of
| the service's counters, IO tasks need to be run.
|
| The catch is that the business logic required to run these IO tasks is
| contained in the UI app. Each service counter consists of a ProjectID and
a
| TimeSpan: the Project corresponding to the ProjectID is defined in the UI,
| and the TimeSpan value is a ticking count based on System Uptime,
maintained
| by the service.
|
| How can the service interact with the UI app to utilize business logic in
| the UI app?
|
| Can I initialize an object in the UI app from the service?
|
| How can I pass the service's TimeSpan to the UI app?
|
| Can the UI app access the service's TimeSpan value at any given point?
|
| Must I use remoting?
|
| Other options?
|
|

This question has been answered a couple of weeks ago, and the answer is
still the same. Yes, you can use remoting for this, but you are not
restricted to remoting, you can use any possible alternative like sockets
named pipes etc to create a communication channel between both UI and
Service. Considered that both UI and Service are managed code applications,
the obvious solution is to use remoting.

Willy.
 
W

William Stacey [MVP]

I not sold that you need another service for this. Why could not the UI spin
up a scheduler when it starts? You thinking something QB scheduler here?

--
William Stacey [MVP]

| I'm trying to finalize a windows service design any would appreciate any
| comments - I'm new to windows services.
|
| Essentially my UI app relies on a service to schedule IO tasks. The
service
| does nothing but keep track of elapsed time.
|
| The reason I need a service is because the IO tasks are login agnostic.
It
| doesn't matter if anyone, or no one, is logged in. The IO tasks are
defined
| in the UI.
|
| When the service starts, it reads from an xml file to get initial values
for
| its counters (a series of integer ProjectIDs and TimeSpan values). If
| during the current system session, the elapsed System Uptime exceeds any
of
| the service's counters, IO tasks need to be run.
|
| The catch is that the business logic required to run these IO tasks is
| contained in the UI app. Each service counter consists of a ProjectID and
a
| TimeSpan: the Project corresponding to the ProjectID is defined in the UI,
| and the TimeSpan value is a ticking count based on System Uptime,
maintained
| by the service.
|
| How can the service interact with the UI app to utilize business logic in
| the UI app?
|
| Can I initialize an object in the UI app from the service?
|
| How can I pass the service's TimeSpan to the UI app?
|
| Can the UI app access the service's TimeSpan value at any given point?
|
| Must I use remoting?
|
| Other options?
|
|
 
D

deko

This question has been answered a couple of weeks ago, and the answer is
still the same. Yes, you can use remoting for this, but you are not
restricted to remoting, you can use any possible alternative like sockets
named pipes etc to create a communication channel between both UI and
Service. Considered that both UI and Service are managed code
applications,
the obvious solution is to use remoting.

Thanks for the reply. I guess I was just looking for more feedback - but I
think you are correct, remoting is the way to go. However, I think I may be
able to make a design change so NO communication will be required between
the UI and the service - other than the UI being able to stop/start/pause
the service.

I tried to design a solution without a service but the app is designed for a
server as well as a workstation. And it's supposed to be a system-wide
utility, not a user-specific tool. But you did challenge me to re-evaluate
this idea.
 
D

deko

I not sold that you need another service for this. Why could not the UI
spin
up a scheduler when it starts? You thinking something QB scheduler here?

QB scheduler? What's that?
 
W

William Stacey [MVP]

Quick Books. Do you really need a shared scheduler or could you not do it
inproc?

--
William Stacey [MVP]

| >I not sold that you need another service for this. Why could not the UI
| >spin
| > up a scheduler when it starts? You thinking something QB scheduler
here?
|
| QB scheduler? What's that?
|
 
D

deko

Quick Books. Do you really need a shared scheduler or could you not do it

inproc? what's that? in-process? what do you mean?

The design goal for this app is for things to happen at intervals of system
uptime. If I wanted a calendar-based scheduler I'd use the Task Scheduler,
which, I think, in .NET 2.0, can be accessed with managed code (it could not
in 1.1).
 
W

William Stacey [MVP]

in-process (i.e. same app, different thread). When the app starts, just
spin another thread and have it record the system uptime. Then do what you
want. What are the intervals, why from system start time? Would app start
time be better? How about some interval from some 12:00 today? Need more
info.

--
William Stacey [MVP]

|> Quick Books. Do you really need a shared scheduler or could you not do
it
| > inproc?
|
| inproc? what's that? in-process? what do you mean?
|
| The design goal for this app is for things to happen at intervals of
system
| uptime. If I wanted a calendar-based scheduler I'd use the Task
Scheduler,
| which, I think, in .NET 2.0, can be accessed with managed code (it could
not
| in 1.1).
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top