I have a scenario where we will be getting 10-15 different XML messages enqueued to a message queue. All of the examples I have found depicting messages via WCF from an Queue show using “typeof – object” to deserialize the message. However, in our case we will have a lot of different messages residing i the queue so simply trying to set a specific type won’t work. How are others handling a similar type of scenario where there are numerous types of messages?
Each message will have a <MessageHeader> and a <MessageBody>, but inside the body the payloads will be different for each message type.
Any suggestions would be greatly appreciated.
You can use the WCF
MsmqIntegrationBindingand handle messages of typeMsmqMessage<string>. Then your handler method will receive the serialized message as a string and can do what you want with it after that.