0

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?

Diego Mijelshon
  • 52,548
  • 16
  • 116
  • 154
Michael Shimmins
  • 19,961
  • 7
  • 57
  • 90

1 Answers1

3

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!

Travis
  • 10,444
  • 2
  • 28
  • 48