开发者

Sending Castle Proxy from NHibernate with MassTransit over MSMQ causes StackOverflowException

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 StackOverflowExce开发者_如何转开发ption. 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?


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜