scarpacci
scarpacci

Reputation: 9194

WCF deserialize messages from MSMQ

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.

Upvotes: 0

Views: 499

Answers (1)

tom redfern
tom redfern

Reputation: 31750

You can use the WCF MsmqIntegrationBinding and handle messages of type MsmqMessage<string>. Then your handler method will receive the serialized message as a string and can do what you want with it after that.

Upvotes: 1

Related Questions