This is part of the NServiceBus Upgrade Guide from Version 5 to 6, which also includes the following individual upgrade guides for specific components:
Feature Details
- Assembly Scanning Changes in NServiceBus Version 6
- No Async Suffix
- Dependency Injection Changes in NServiceBus Version 6
- Deprecated TransportMessage in NServiceBus Version 6
- Endpoint API changes in NServiceBus Version 6
- Extension Seam Changes in NServiceBus Version 6
- Migrate handlers and sagas to Version 6
- Header API changes in NServiceBus Version 6
- Messaging Changes in NServiceBus Version 6
- Moving away from IBus in Version 6
- Recoverability Changes in Version 6
- Serialization Changes in NServiceBus Version 6
- Subscription Changes in NServiceBus Version 6
- Transaction Configuration Changes in NServiceBus Version 6
Transports
- Azure Service Bus Transport (Legacy) Upgrade Version 6 to 7
- RabbitMQ Transport Upgrade Version 3 to 4
- SQL Server Transport Upgrade Version 2 to 3
- SQL Server Transport Upgrade - Supporting Unicode in Headers
Persistence
- Upgrade from NServiceBus Azure Version 6
- NHibernate Persistence Upgrade Version 6 to 7
- NHibernate Persistence - Resolving incorrect timeout table indexes
- RavenDB Persistence Upgrade from 3 to 4
Hosting
Other
- Moving to the DataBus AzureBlobStorage Package
- Azure Cloud Services Host Upgrade Version 6 to 7
- NServiceBus.Azure package deprecated
- Gateway Upgrade Version 1 to 2
- NServiceBus Testing Upgrade Version 5 to 6
- Callback Changes in NServiceBus Version 6
- Migrating the distributor to use sender-side distribution
- Tool and Helper Changes in NServiceBus Version 6
Namespace changes
All types specified in this document are now in the NServiceBus
namespace.
IConfigureThisEndpoint changes
IConfigureThisEndpoint.
is passed an instance of EndpointConfiguration
instead of BusConfiguration
.
// For Azure Cloud Service Host version 8.x
public class EndpointConfig :
IConfigureThisEndpoint,
AsA_Worker
{
public void Customize(EndpointConfiguration endpointConfiguration)
{
// Configure transport, persistence, etc.
}
}
// For Azure Cloud Service Host version 7.x
public class EndpointConfig :
IConfigureThisEndpoint,
AsA_Worker
{
public void Customize(EndpointConfiguration endpointConfiguration)
{
// Configure transport, persistence, etc.
}
}
// For Azure Cloud Service Host version 6.x
public class EndpointConfig :
IConfigureThisEndpoint,
AsA_Worker
{
public void Customize(BusConfiguration busConfiguration)
{
// Configure transport, persistence, etc.
}
}
AsA_Host role changes into IConfigureThisHost
The specifiers IConfigureThisEndpoint
and AsA_Host
are now merged into IConfigureThisHost
.
// For Azure Cloud Service Host version 8.x
public class EndpointHostConfig :
IConfigureThisHost
{
public HostingSettings Configure()
{
return new HostingSettings("DefaultEndpointsProtocol=https;AccountName=[ACCOUNT];AccountKey=[KEY];");
}
}
// For Azure Cloud Service Host version 7.x
public class EndpointHostConfig :
IConfigureThisHost
{
public HostingSettings Configure()
{
return new HostingSettings("DefaultEndpointsProtocol=https;AccountName=[ACCOUNT];AccountKey=[KEY];");
}
}
// For Azure Cloud Service Host version 6.x
public class EndpointHostConfig :
IConfigureThisEndpoint,
AsA_Host
{
public void Customize(BusConfiguration configuration)
{
}
}
Removal of DynamicHostControllerConfig
The DynamicHostControllerConfig
configuration section has been removed; instead the IConfigureThisHost.
implementation must return an instance of HostSettings
which contains the configuration values.
RoleEnvironment.
can be used to read an existing configuration setting from the .
file.
Removal of dependencies
The host role entry point and host process no longer depend on the following components.
- Log4Net
- Ionic.zip
- Topshelf
- CommonServiceLocator
If these components are not used for other purposes they may be removed.
Deprecation of profiles
The infrastructure backing profiles has been removed from the host and therefore the Development
and Production
profiles are no longer available. Note that Visual Studio native logging has replaced the profiles.
Any code in custom profile handlers should be moved into the IConfigureThisEndpoint
or IConfigureThisHost
configuration extension points.
IWantToRunWhenEndpointStartsAndStops
A new interface IWantToRunWhenEndpointStartsAndStops
has been added. This interface replaces the IWantToRunWhenBusStartsAndStops
in the NServiceBus core.
Interface in NServiceBus version 5
public class Bootstrapper :
IWantToRunWhenBusStartsAndStops
{
public void Start()
{
// Do startup actions here.
}
public void Stop()
{
// Do cleanup actions here.
}
}
Interface in NServiceBus.Hosting.Azure version 7
public class Bootstrapper :
IWantToRunWhenEndpointStartsAndStops
{
public Task Start(IMessageSession session)
{
// Do startup actions here.
// Either mark Start method as async or do the following
return Task.CompletedTask;
}
public Task Stop(IMessageSession session)
{
// Do cleanup actions here.
// Either mark Stop method as async or do the following
return Task.CompletedTask;
}
}