Question

I'm trying to send a message with MassTransit over MSMQ. The message contains two properties which are types obtained from an NHibernate query and contain Castle Proxies (for lazy loading).

If I send the message (using bus.Endpoint.Send(msg)) with the proxies as part of the message I generate a StackOverflowException. If I don't assign these two properties, and leave them null, the message fires through the queue without issue.

Is this just the way it is, or am I doing something wrong with the MSMQ/MassTransit setup?

If not, would I need to use something like AutoMapper to get rid of these proxies?

Was it helpful?

Solution

This is likely an exception based upon the dynamic proxies generated and the serializer being used. I assume it's the default XML serializer? I would post an issue to the github page for MT so we can look at this: https://github.com/MassTransit/MassTransit

These messages should be consider contracts for decoupling between processes. Using NHibernate entities, these services become coupled with more than just the messages as a DB change could effect the other consumers. Ideally you would always map this to another object before passing it along.

Is there a reason why you aren't just bus.Publish(msg) instead of sending directly to the Bus' endpoint? You could join the MT mailing list and discuss this in more detail: http://groups.google.com/group/masstransit-discuss

I hope this helps!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top