Can this be done?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following situation:

1. Need to create a windows service that can pick up files to process and
hand off the work to a 'Processor' hosted in COM+, this should be
asynchronous, the service will retain a handle (for want of a better word) to
the processor.

2. The 'Processor' will report back to the windows service that gave it the
work during the processing to inform it how the processing is going on.

I have no problem in creating the service or the processor, its just the
communication between them where I have questions.

I understand that I could create a delegate to handle the whole
processor-work functionality. As I understand it the delegate thread is in
the same thread pool as the main process and obviously the more threads in
the pool working the slower the main process will be.

Looking at MSDN the IAsyncResult seems to provide me with a way for the
Processor to report that its finished its work but I need on going
communication between the 2 with the Processor passing information back to
the service which it will in turn use for updating a database. Before .Net I
would have created a callback and have part of the information passed back
indicate the state e.g. data or finished which would allow the service to
decided what to do with the message.

I'm short on time and long on requirements, does anybody know if what I can
do what I need or do I need to change the architecture?
 
Nathan,

I don't know that I would try to perform a callback from within COM+.
It just doesn't seem natural, to be honest.

What I would do is have the processor send a message over MSMQ, or use
COM+ events to fire an event that you can subscribe to. If you use MSMQ,
then your service will have to listen on the queue for messages, and perform
the processing when it receives it. If you use COM+ events, you don't even
have to write anything in your service. Instead, you can create a component
that will be created and called when the event is fired.

Hope this helps.
 
Thanks for that Nicholas, hadn't really considered COM+ Events company I work
for saw them as 'too complex' and had written them off, much the same as MSMQ.

The only question I have is if I use COM+ events which will allow the
processor to communicate with the service can I also use them for the service
sending messages to the processor for example abort processing? or would I
have to look at using both COM+ events and MSMQ to achieve this?

Thanks

Nicholas Paldino said:
Nathan,

I don't know that I would try to perform a callback from within COM+.
It just doesn't seem natural, to be honest.

What I would do is have the processor send a message over MSMQ, or use
COM+ events to fire an event that you can subscribe to. If you use MSMQ,
then your service will have to listen on the queue for messages, and perform
the processing when it receives it. If you use COM+ events, you don't even
have to write anything in your service. Instead, you can create a component
that will be created and called when the event is fired.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Nathan said:
I have the following situation:

1. Need to create a windows service that can pick up files to process and
hand off the work to a 'Processor' hosted in COM+, this should be
asynchronous, the service will retain a handle (for want of a better word)
to
the processor.

2. The 'Processor' will report back to the windows service that gave it
the
work during the processing to inform it how the processing is going on.

I have no problem in creating the service or the processor, its just the
communication between them where I have questions.

I understand that I could create a delegate to handle the whole
processor-work functionality. As I understand it the delegate thread is in
the same thread pool as the main process and obviously the more threads in
the pool working the slower the main process will be.

Looking at MSDN the IAsyncResult seems to provide me with a way for the
Processor to report that its finished its work but I need on going
communication between the 2 with the Processor passing information back to
the service which it will in turn use for updating a database. Before
.Net I
would have created a callback and have part of the information passed back
indicate the state e.g. data or finished which would allow the service to
decided what to do with the message.

I'm short on time and long on requirements, does anybody know if what I
can
do what I need or do I need to change the architecture?
 
Nathan,

If you use COM+ events, then you can go one of two ways.

If the event doesn't require any specific information from the service,
you can have the COM+ event create a new instance of the handler, and then
the handler will just perform the action that it needs to perform. Or, you
can actually register a class in your application to be the handler, while
your application is active.

If you want to send a notification to the processor in COM+, it's just
like calling a method. You just have a method which causes the processing
to stop.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Nathan said:
Thanks for that Nicholas, hadn't really considered COM+ Events company I
work
for saw them as 'too complex' and had written them off, much the same as
MSMQ.

The only question I have is if I use COM+ events which will allow the
processor to communicate with the service can I also use them for the
service
sending messages to the processor for example abort processing? or would
I
have to look at using both COM+ events and MSMQ to achieve this?

Thanks

Nicholas Paldino said:
Nathan,

I don't know that I would try to perform a callback from within COM+.
It just doesn't seem natural, to be honest.

What I would do is have the processor send a message over MSMQ, or
use
COM+ events to fire an event that you can subscribe to. If you use MSMQ,
then your service will have to listen on the queue for messages, and
perform
the processing when it receives it. If you use COM+ events, you don't
even
have to write anything in your service. Instead, you can create a
component
that will be created and called when the event is fired.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Nathan said:
I have the following situation:

1. Need to create a windows service that can pick up files to process
and
hand off the work to a 'Processor' hosted in COM+, this should be
asynchronous, the service will retain a handle (for want of a better
word)
to
the processor.

2. The 'Processor' will report back to the windows service that gave it
the
work during the processing to inform it how the processing is going on.

I have no problem in creating the service or the processor, its just
the
communication between them where I have questions.

I understand that I could create a delegate to handle the whole
processor-work functionality. As I understand it the delegate thread is
in
the same thread pool as the main process and obviously the more threads
in
the pool working the slower the main process will be.

Looking at MSDN the IAsyncResult seems to provide me with a way for the
Processor to report that its finished its work but I need on going
communication between the 2 with the Processor passing information back
to
the service which it will in turn use for updating a database. Before
.Net I
would have created a callback and have part of the information passed
back
indicate the state e.g. data or finished which would allow the service
to
decided what to do with the message.

I'm short on time and long on requirements, does anybody know if what I
can
do what I need or do I need to change the architecture?
 
Thanks for that Nicholas, I will investigate further.

Nicholas Paldino said:
Nathan,

If you use COM+ events, then you can go one of two ways.

If the event doesn't require any specific information from the service,
you can have the COM+ event create a new instance of the handler, and then
the handler will just perform the action that it needs to perform. Or, you
can actually register a class in your application to be the handler, while
your application is active.

If you want to send a notification to the processor in COM+, it's just
like calling a method. You just have a method which causes the processing
to stop.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Nathan said:
Thanks for that Nicholas, hadn't really considered COM+ Events company I
work
for saw them as 'too complex' and had written them off, much the same as
MSMQ.

The only question I have is if I use COM+ events which will allow the
processor to communicate with the service can I also use them for the
service
sending messages to the processor for example abort processing? or would
I
have to look at using both COM+ events and MSMQ to achieve this?

Thanks

Nicholas Paldino said:
Nathan,

I don't know that I would try to perform a callback from within COM+.
It just doesn't seem natural, to be honest.

What I would do is have the processor send a message over MSMQ, or
use
COM+ events to fire an event that you can subscribe to. If you use MSMQ,
then your service will have to listen on the queue for messages, and
perform
the processing when it receives it. If you use COM+ events, you don't
even
have to write anything in your service. Instead, you can create a
component
that will be created and called when the event is fired.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

I have the following situation:

1. Need to create a windows service that can pick up files to process
and
hand off the work to a 'Processor' hosted in COM+, this should be
asynchronous, the service will retain a handle (for want of a better
word)
to
the processor.

2. The 'Processor' will report back to the windows service that gave it
the
work during the processing to inform it how the processing is going on.

I have no problem in creating the service or the processor, its just
the
communication between them where I have questions.

I understand that I could create a delegate to handle the whole
processor-work functionality. As I understand it the delegate thread is
in
the same thread pool as the main process and obviously the more threads
in
the pool working the slower the main process will be.

Looking at MSDN the IAsyncResult seems to provide me with a way for the
Processor to report that its finished its work but I need on going
communication between the 2 with the Processor passing information back
to
the service which it will in turn use for updating a database. Before
.Net I
would have created a callback and have part of the information passed
back
indicate the state e.g. data or finished which would allow the service
to
decided what to do with the message.

I'm short on time and long on requirements, does anybody know if what I
can
do what I need or do I need to change the architecture?
 
Back
Top