Strange One We have a multi-threaded app that pulls the message from MSMQ queue and then works based on messages is. All this is done using DTC.
Occasionally, for some reason I can not describe, while reading the queued closed message, we read the message.
This code is used in the app:
Message [] All messagesNews = this.messageQueue.GetAllMessages (); Foreach (current message message message in all messages) {if ((currentMessage.Body is IEMessageIDealWith)) {// do something; }}
When the current message. Body is used, sometimes it throws an exception:
System. Unknown Operation Exception: Property body was not recovered while receiving message Make sure that the property filter is set correctly.
Now - this only happens for some time - and it appears as if the physical property in the messageReadPropertyFilter on the line is false.
How can this be a bit of a mystery? Body property is a mistake and we absolutley never clearly set it to false.
Do any such other The person has been seen or has some idea why this man is lying?
As previously mentioned, you explicitly System.Messaging.MessagePropertyFilter
object can set boolean values based on your messageQueue
object MessageReadPropertyFilter
property.
If you want all data removed when a message is received or edgy, then use it:
This.messageQueue.MessageReadPropertyFilter.SetAll (); // Add this line [message] [] All messagesNews = it. Message Queue Gate all messages (); // ...
This may affect the performance of many messages, so if you want some additional features, then a new MessagePropertyFilter
Create:
// Specify the properties of the selected MessagePropertyFilter filter = New MessagePropertyFilter (); Filter.ClearAll (); Filter.Body = True; Filter. Priority = true; This.messageQueue.MessageReadPropertyFilter = Filter; Message [] All messagesonews = this. Message Queue Gate all messages (); // ...
You can also set it back to the default by using:
this .messageQueue. MessageReadPropertyFilter.SetDefaults ();
More info here:
Comments
Post a Comment