In my Program.cs
public static IBus Bus { get; set; }
[STAThread]
static void Main()
{
Bus = Configure.With()
.DefaultBuilder()
.XmlSerializer()
.MsmqTransport()
.PurgeOnStartup(true)
.UnicastBus()
.SendOnly();
var order = new PlaceOrder
{
OrderID = Guid.NewGuid(),
ProductID = Guid.NewGuid(),
CustomerID = Guid.NewGuid(),
};
Bus.Send(order);
}
The Error I get:
No destination specified for message(s): MessagingContracts.PlaceOrder
MessagingContracts.PlaceOrder is a class in a class library:
namespace MessagingContracts
{
public class PlaceOrder:IMessage
{
public Guid CustomerID { get; set; }
public Guid OrderID { get; set; }
public Guid ProductID { get; set; }
}
}
My end point is configured in app.config as:
<configSections>
<section name="MsmqTransportConfig" type="NServiceBus.Config.MsmqTransportConfig, NServiceBus.Core" />
<section name="UnicastBusConfig" type="NServiceBus.Config.UnicastBusConfig, NServiceBus.Core"></section>
</configSections>
<UnicastBusConfig>
<MessageEndpointMappings>
<add Messages="MessagingContracts" Endpoint="MessagingEndPoint"></add>
</MessageEndpointMappings>
</UnicastBusConfig>
My endpoint class
namespace MessagingEndPoint
{
public class EndPointConfig : IConfigureThisEndpoint, AsA_Server
{
}
}
How do i correct that error and see my message in my private queue(MessagingEndPoint)? Any inputs on this error cause would be highly helpful.
Okay, this one did the trick & mentioning the endpoint name(destination) along the send method passes the message to the queue.
Bus.Send("MessagingEndPoint", order); //use this
instead of
Bus.Send(order);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.