My application is trying to receive events from an endpoint.
If I Subscribe<>() explicitly I see a subscription coming in on the publishing endpoint. If I try to get the same result by configuring a convention, it fails.
What am I missing?
My configuration looks like this:
public Subscriber(int maxConcurrency)
{
var pingEventType = typeof(IMyEvent);
var pingHandlerType = typeof(MyEventHandler);
var busConfiguration = new BusConfiguration();
busConfiguration.EndpointName("MyEndpointName");
busConfiguration.UseSerialization<JsonSerializer>();
busConfiguration.EnableInstallers();
busConfiguration.UsePersistence<NHibernatePersistence>();
busConfiguration
.UseTransport<SqlServerTransport>()
.CallbackReceiverMaxConcurrency(maxConcurrency);
busConfiguration.AssembliesToScan(AllAssemblies
.Matching("NServiceBus")
.And("ServiceControl")
.And(pingHandlerType.AssemblyQualifiedName)
.And(pingEventType.AssemblyQualifiedName));
busConfiguration
.Conventions()
.DefiningEventsAs(x => x.Namespace != null && x.Namespace == pingEventType.Namespace);
var container = new ContainerBuilder().Build();
busConfiguration.UseContainer<AutofacBuilder>(customizations =>
{
customizations.ExistingLifetimeScope(container);
});
_startableBus = Bus.Create(busConfiguration);
// Uncommenting below line results in subscription on the publishing endpoint
//_startableBus.Subscribe(pingEventType);
}
The most relevant documentation and sample code doesn't seem to mention anything else I should do https://docs.particular.net/nservicebus/messaging/conventions?version=core_5
Found it. AssemblyQualifiedName is the name of the type prefixed with the assembly. What I needed was the name of the assembly itself. So
Should have been
What threw me off for hours was that type.Assmembly.FullName is the name of the assembly with all it's version info etc attached. That doesn't work either.