So I have two separate applications that I want to send messages between. I happen to be using NServiceBus, but that shouldn't really matter. How do I send a message from application A to application B and have them both be aware of the same contract?
So app A has a class SecretMessage...
public class SecretMessage : IMessage
{
public string Title { get; set; }
public string Body { get; set; }
}
This is the object that will be serialized and sent over the wire to app B.
Now in app B, how do I listen for messages that are of that type and then be able to de-serialze them to the same class? So I can use the data as it was sent, without this being a maintenance nightmare.
Does app B just have to have a copy of the class? Should this be handled through a shared dll of message classes that each app has a reference to (I hope not)? Should they be recreated in each app as completely separate DTO's with the same properties?
Am I missing something here?