NServiceBus 5.2.10
NHibernate Persistence Enabled
AspNetMvC Hosting
I know this is a basic question, but I have this working in several web endpoints except one new that we are creating from scratch.
I have configured everything in the same way we did before but NSB cant find the destination for message type..
But when run Bus.Send = No destination could be found for message type
Here is my Bus init code:
BusConfiguration busConfiguration = new BusConfiguration();
busConfiguration.EndpointName(Consts.WebEndpointName);
busConfiguration.PurgeOnStartup(false);
busConfiguration.Transactions().Disable();
busConfiguration.EnableInstallers();
// Start
var startableBus = Bus.Create(busConfiguration);
IBus bus = startableBus.Start();
Logger.InfoFormat("NServiceBus endpoint {0} started successfully", Consts.WebEndpointName);
This is my Web.config entries (MyApp.Namespace1.InternalMessages is the assembly containing internalmessages)
<!-- NServiceBus-->
<TransportConfig MaximumConcurrencyLevel="1" MaxRetries="1" />
<Logging Threshold="DEBUG" />
<UnicastBusConfig>
<MessageEndpointMappings>
<add Assembly="MyApp.Namespace1.InternalMessages"
Endpoint="MyApp.BackendProcessing" />
</MessageEndpointMappings>
</UnicastBusConfig>
<!-- End Of NServiceBus-->
I have separated classes for configuration in a different assembly (referenced by web project):
This is the message conventions:
public class ConfigMessageConventions : INeedInitialization
{
public void Customize(BusConfiguration configuration)
{
ConventionsBuilder conventions = configuration.Conventions();
conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyApp.Namespace1") && t.Namespace.EndsWith("Commands"));
conventions.DefiningEventsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyApp.Namespace1") && t.Namespace.EndsWith("Contracts"));
conventions.DefiningCommandsAs(t => t.Namespace != null && t.Namespace.StartsWith("MyApp.Namespace1") && t.Namespace.EndsWith("RequestResponse"));
//conventions.DefiningEncryptedPropertiesAs(p => p.Name.StartsWith("Encrypted"));
//conventions.DefiningDataBusPropertiesAs(p => p.Name.EndsWith("DataBus"));
//conventions.DefiningExpressMessagesAs(t => t.Name.EndsWith("Express"));
//conventions.DefiningTimeToBeReceivedAs(t => t.Name.EndsWith("Expires") ? TimeSpan.FromSeconds(30) : TimeSpan.MaxValue);
}
}
Command being sent:
namespace MyApp.Namespace1.InternalMessages.Commands
{
public class PublishMyEntityCreated
{
[Required]
public int? MyEntityId { get; set; }
}
}
Thanks a lot
Bruno