简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM