I am attempting to publish a message as shown below
_bus.Publish(new BatchCompleted { BatchId = batch.Id});
And handle it in a BatchCompletedHandler:
public class BatchCompletedHandler: IHandleMessages<BatchCompleted>
{
public void Handle(BatchCompleted message)
{
Do Some Stuff...
}
}
Whenever I try and publish the message I get the following System.Exception:
Could not find Metadata for 'MyAssembly.BatchCompleted'. Messages need to implement either 'IMessage', 'IEvent' or 'ICommand'. Alternatively, if you don't want to implement an interface, you can configure 'Unobtrusive Mode Messages' and use convention to configure how messages are mapped.
The message does implement IEvent as shown below
[Serializable]
public class BatchCompleted : IEvent
{
public int BatchId{ get; set; }
}
I am configuring NSB using the following code
Configure.With(MyAssembly)
The message handler is in the assembly MyAssembly and the messages are in the MyMessagesAssembly.
What am I doing wrong?