Reputation: 634
I am trying to set up a generic rebus publishing service that allows any of our web applications to push out event messages for subcribers. The service's only job is to maintain the subscriptions and republish any messages it receives. I want to avoid having to create specific IHandleMessage implementations in the service, because it shouldn't need to know anything about the incoming message other than its type.
I have tried a number of approaches (IHandleMessages for example) and rebus crashes when it tries to deserialize a message it doesn't have the assembly for.
Upvotes: 1
Views: 92
Reputation: 18628
Oh yeah, sure you can do that - but a true pass-through can only be made if you avoid deserializing the message altogether, which you can easily do by using your own serializer.
If you implement ISerializeMessages as, say, PassThroughSerializer
, you can configure the publisher like this:
Configure.With(...)
.(...)
.Serializer(s => s.Use(new PassThroughSerializer())
.(...)
As you can see, your serializer needs to be able to turn an incoming ReceivedTransportMessage
(basically just a dictionary of headers and a byte[]
) into a Message
, which is the same headers and an object[]
In your case, you would just actually not do any deserialization and just pass the byte[]
into the Message
, and conversely pass it out again when it's time to create a TransportMessageToSend
.
I hope that makes sense :)
Upvotes: 1