So I'm trying to send a simple message from a SharePoint webpart to an endpoint. For now, i'm setting the bus in a simple static class use in the webpart. The class gets called and the bus seems to be working, but when i try to send the message, i get:
No destination specified for message SharePointMessages.CreateProject. Message cannot be sent. Check the UnicastBusConfig section in your config file and ensure that a MessageEndpointMapping exists for the message type.
The class looks like this:
public static class Infrastructure
{
public static IBus Bus { get; private set; }
static Infrastructure()
{
var mappings = new MessageEndpointMappingCollection();
mappings.Add(new MessageEndpointMapping()
{
Messages = "SharePointMessages.CreateProject",
Endpoint = "SharePointProxy"
});
Configure config = Configure.WithWeb();
config
.Log4Net()
.DefaultBuilder()
.XmlSerializer()
.MsmqTransport()
.IsTransactional(true)
.UnicastBus()
.Configurer.ConfigureComponent<UnicastBusConfig>(ComponentCallModelEnum.None)
.ConfigureProperty(x => x.MessageEndpointMappings, mappings);
Bus = config.CreateBus().Start();
}
}
The SharePointMessages.CreateProject class implements IMessage and has two properties. The queues get created properly if they are not there. So it seems like everything is working but for some reason the mappings are not there. Can anyone see what I'm doing wrong?
Cheers