wcfmsmqnetmsmqbindingwcf-callbacksmsmq-wcf

Can a WCF service object implementing a contract for a net.msmq endpoint also implement a callback contract for a net.tcp endpoint?


Trying to implement a MSMQ-backed WCF PubSub. I understand that net.msmq is one-way; however when I use a single service object to implement the net.msmq endpoint for reading from the underlying queue, and a net.tcp endpoint for listeners to subscribe to with callbacks, I'm running into a lot of complaints about one-way vs. two-way, DuplexChannelFactory, DuplexClientBase, etc. etc.

It almost seems like the only way to implement this is to have the net.msmq queue reading service be a client to a net.tcp publisher service, and notify the publisher when the new message is read from the queue, rather than publish the message to subscribers internally. Or, to not use net.msmq on the receiver, and just ready with a plain old MessageQueue object instead.


Solution

  • After refactoring some interfaces and finding some missing attribution and awkard relationships between subscriber and callback implementor, I have established the intended queue-backed pubsub pattern. So yes, it is possible, previous difficulties were design error on my part.

    Edit/footnote: For some reason, messages previously passed to the net.msmq receiver as MsmqMessage are now throwing nullreferenceexceptions; however changing the signature to MyObject works, which it did not initially