By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,220 Members | 1,516 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,220 IT Pros & Developers. It's quick & easy.

windows service questions

P: n/a
ZQ
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate threads
than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.
Feb 8 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process. The
Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a service
stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.

Feb 8 '06 #2

P: n/a
ZQ
Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which it
processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process. The
Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a service
stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be invoked
after all pending events are finished?

thanks!

Z.


Feb 9 '06 #3

P: n/a
> if an administrator stops the service while
the service is processing the message, will it kill the thread in which it
processes the message?
Not necessarily. The Stop event sends a message to the service application
to stop. It doesn't kill the thread. That's why there's an event handler
there. But make sure that you account for the Stop event, and don't take too
long to finish up. Then you'll be just fine.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl... Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an
event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which it
processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process.
The Starting and Stopping of services is not a concern of MSMQ. MSMQ is a
messenger. It queues messages, and delivers them when it can. If a
service stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be
invoked after all pending events are finished?

thanks!

Z.



Feb 9 '06 #4

P: n/a
ZQ

That's the info I needed.
Thanks, Kevin
"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:On**************@TK2MSFTNGP09.phx.gbl...
if an administrator stops the service while
the service is processing the message, will it kill the thread in which
it processes the message?


Not necessarily. The Stop event sends a message to the service application
to stop. It doesn't kill the thread. That's why there's an event handler
there. But make sure that you account for the Stop event, and don't take
too long to finish up. Then you'll be just fine.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Ok. Thanx for your quick response.
However.

In my win. service, I have configured it to asynchronously fire up an
event
every time a message arrives into a message queue. Once it fires, I
endreceive the
message (and deserialize it), and process the received object. The
processing
takes awhile, and my real question is - if an administrator stops the
service while
the service is processing the message, will it kill the thread in which
it processes the message?

"Kevin Spencer" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:u%****************@TK2MSFTNGP09.phx.gbl...
Services and MSMQ (which is also a service) have nothing to do with each
other, unless you tell them to. Every service runs in its own process.
The Starting and Stopping of services is not a concern of MSMQ. MSMQ is
a messenger. It queues messages, and delivers them when it can. If a
service stops, and then starts later, the message will still be there.

--
HTH,

Kevin Spencer
Microsoft MVP
.Net Developer
We got a sick zebra a hat,
you ultimate tuna.
"ZQ" <zv*****@yahoo.com> wrote in message
news:uG**************@TK2MSFTNGP14.phx.gbl...
Hi all!

I have few questions regarding .net windows services

1. are onStart, onStop and other "system" events invoked in separate
threads than msmq events?
2. if so, is there a way for the onStop event to wait with stopping the
service until pending msmq events are finished?
3. if not, does that mean that the onStop event would actually be
invoked after all pending events are finished?

thanks!

Z.



Feb 10 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.