Message listener adapter that delegates the handling of messages to target listener methods via reflection DynamicReflectionManager, with flexible message type conversion. Allows listener methods to operate on message content types, completely independent from the MSMQ API.
For a list of all members of this type, see MessageListenerAdapter Members .
Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.
By default, the content of incoming MSMQ messages gets extracted before being passed into the target handler method, to let the target method operate on message content types such as String or business object instead of Message. Message type conversion is delegated to a Spring IMessageConverter By default, an XmlMessageConverter with TargetType set to System.String is used. If you do not want such automatic message conversion taking place, then be sure to set the MessageConverter property to null.
If a target handler method returns a non-null object (for example, with a message content type such as
String), it will get wrapped in a MSMQ
Messageand sent to the response destination (either using the MSMQ Message.ResponseQueue property or DefaultResponseQueue) specified default response queue destination).
Find below some examples of method signatures compliant with this adapter class. This first example uses the default XmlMessageConverter that can marhsall/unmarshall string values from the MSMQ Message.
The next example indicates a similar method signature but the name of the handler method name has been changed to "DoWork", using the property DefaultHandlerMethod
If your IMessageConverter implementation will return multiple object types, overloading the handler method is perfectly acceptible, the most specific matching method will be used. A method with an object signature would be consider a 'catch-all' method
The last example shows how to send a message to the ResponseQueue for those methods that do not return void.
Assembly: Spring.Messaging (in Spring.Messaging.dll)