I am self hosting a WCF service in a Windows Service which has two endpoints. TCP one is attached to one interface implementation, and MSMQIntegration one is attached to another interface implementation.
I would like to build functionality that would allow me to suspend the MSMQ endpoint for a period of time (so that it stops looking for messages on the queue), and then build another that would allow me to re-enable it. I want to do this without out stopping the ServiceHost and not interfering with the TCP endpoint at all.
I have tried to remove the endpoint from ServiceHost.Description.Endpoints
, but I can't add it back in later. I think maybe there can be something done with the ChannelDispatcher
, but I am not real sure on what to do.
The reason that I am not running two ServiceHosts is because the TCP interface's method are there to report on the status and throughput of the MSMQ endpoint. Also (in the future), I would like to add methods to the TCP interface that would allow an admin to dynamically configure the MSMQ endpoint on the fly, without shutting down and restarting the MSMQ endpoint. If the TCP ServiceHost is different than the MSMQ I am not sure how to keep variable scope for reporting and configuration.
SO..basically I am looking to suspend a listener, and not to shut it off and start it back up again. How can I achieve this?