I’m currently learning wcf for an up and coming project.
The service I am creating is using MSMQ to update the database, but the database can’t accept messages at certain times.
The service is going to be a windows service. The one thing I am coming up against at the moment is how I can get the service to stop reading messages from the queue at these times, for instance lets say I don’t want to read messages from the queue on sundays. How would I go about implementing this. So that the client can send messages to the queue that update the database but the service doesn’t read the messages until monday, so that the database gets all the updates on the monday?
I have started looking at creating a customhost, but I’m not sure if I’m heading in the right direction with this.
Thanks in advance.
To finally get a solution that worked I rolled my own IInputChannel (which overrided the WaitForMessage and BeginWaitForMessage methods so that they returned False on say a Sunday) this is so that the channel couldn’t receive any messages, I also created a new channel Listener to implement the custom channel, and then created a new bindingelement for the channel listener.
I had to change a few things like the time to live for messages and also the default timeout for the the channel listener.
The basics of the service are up and I now have a working concept to go forward with.