Board index » cppbuilder » tservice usage

tservice usage


2003-09-14 09:19:29 AM
cppbuilder31
some service questions...
what is the difference between tservice and tservice application? (aside
from the obvious in the help...)
when I open a new instance of each, they do not appear any differently from
one another. why is that? or is a tserviceapplication also a tservice?
regards,
michael
 
 

Re:tservice usage

"Michael Powell" < XXXX@XXXXX.COM >wrote in message
Quote
what is the difference between tservice and tservice application?
That is like asking "what is the difference between TForm and TApplication".
Creating a new "Service Application" creates a new executable project
containing a TServiceApplication which then controls and maintains TService
instances, each TService for each service you want the executable to have.
Just like a normal application can have multiple forms, a service
application can have multiple services.
Quote
when I open a new instance of each, they do not appear any
differently from one another. why is that?
When you create a new "Service Application", it automatically creates a
TService as well, just as creating a normal application automatically
creates a TForm for its MainForm.
Quote
or is a tserviceapplication also a tservice?
No.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
 

Re:tservice usage

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Michael Powell" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>what is the difference between tservice and tservice application?

That is like asking "what is the difference between TForm and
TApplication".
Creating a new "Service Application" creates a new executable project
containing a TServiceApplication which then controls and maintains
TService
instances, each TService for each service you want the executable to have.
Just like a normal application can have multiple forms, a service
application can have multiple services.
Ok, multiple services. That has some appealing benefits.
May those services be linked to one another? For example one being a
watchdog while the others do the actual work? In the same thought, the
watchdog would be a depency by the others?
Quote
When you create a new "Service Application", it automatically creates a
TService as well, just as creating a normal application automatically
creates a TForm for its MainForm.
Yes, but the "TService" is actually the TServiceApplication. This is where
the line blurs somewhat.
Quote
>or is a tserviceapplication also a tservice?

No.
Or maybe a better answer is "in a manner of speaking"? (see above)
Given that services tend to spawn threads to handle the work, IPC and the
usual rules about memory sharing is a common thing, between services and
their applications, and between services and other services?
 

{smallsort}

Re:tservice usage

"Michael Powell" < XXXX@XXXXX.COM >wrote in message
Quote
Ok, multiple services. That has some appealing benefits.
It depends on the types of services you are actually making. Not all
service types can be contained in an executable with other services, they
need to have their own executable all to themselves.
Quote
May those services be linked to one another?
Multiple TService instances residing in the same TServiceApplication have
nothing to do with each other at all, they are separate entities that just
happen to be contained in a single executable file, that is all.
Quote
For example one being a watchdog while the others do the actual work?
I suppose it may be possible. I'm not sure. I've never used services that
way before. None of my projects dictate a need to host multiple services in
the same executable, they each have their own.
Quote
In the same thought, the watchdog would be a depency by the others?
Dependancies have nothing to do with having services contained in the same
executable. As far as the SCM is concerned, each service is unique and
independant from other services.
Quote
Yes, but the "TService" is actually the TServiceApplication.
No, it is not. It is a normal TService like any other. I guess I wasn't
clear earlier. Perhaps this will be clearer to understand:
"When you create a new "Service Application", it ***also***
automatically creates a ***new*** TService as well".
A TService is *not* a TServiceApplication, and a TServiceApplication is
*not* a TService. Just like a TApplication is not a TForm and a TForm is
not a TApplication. They have very different purposes.
Quote
Or maybe a better answer is "in a manner of speaking"?
No, not in a manner of speaking. They are not the same thing at all. Do
not confuse them. The job of the TServiceApplication is to host the entry
points which the SCM calls into, to hold on to an array of TService
pointers, and to make sure that SCM requests are forwarded to the correct TS
ervice. Nothing else. The actual services themselves are controlled by
the TService instances only.
Gambit
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (www.grisoft.com).
Version: 6.0.515 / Virus Database: 313 - Release Date: 9/1/03
 

Re:tservice usage

"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Michael Powell" < XXXX@XXXXX.COM >wrote in message
news:3f63dbf0$ XXXX@XXXXX.COM ...

>Yes, but the "TService" is actually the TServiceApplication.

No, it is not. It is a normal TService like any other. I guess I wasn't
clear earlier. Perhaps this will be clearer to understand:

"When you create a new "Service Application", it ***also***
automatically creates a ***new*** TService as well".

A TService is *not* a TServiceApplication, and a TServiceApplication is
*not* a TService. Just like a TApplication is not a TForm and a TForm is
not a TApplication. They have very different purposes.
Yes, this is clearer to me now. Service Application hides well behind the
scenes. It just so happens that Service is the face that is presented. In
other words, as you indicated previously, every Service Application carries
with it at least one Service, the Service that is created initially.
Additional Services may be added, which run separately from the same host
Service Application.
Taking this into account, some flavor of IPC would be required to facilitate
communications between them (presumably execution threads running within
each service).
Thanks for the clarity.
Regards,
Michael