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
Extensibility
IForwardMessagesToSites
, IRouteMessagesToEndpoints
, and IRouteMessagesToSites
have been deprecated and are no longer available as extension points in the gateway. These have been replaced by custom channel types.
Concurrency configuration
NumberOfWorkerThreads
is deprecated as a parameter for channels in the endpoint config file. Use MaxConcurrency
to set the maximum number of messages that should be processed at any given time by the gateway instead.
// For Gateway version 2.x
<GatewayConfig>
<Channels>
<Channel Address="http://hq.mycorp.com/"
ChannelType="Http"
MaxConcurrency="3"/>
</Channels>
</GatewayConfig>
// For Gateway version 1.x
<GatewayConfig>
<Channels>
<Channel Address="http://hq.mycorp.com/"
ChannelType="Http"
NumberOfWorkerThreads="3"/>
</Channels>
</GatewayConfig>
Automatic retries
In versions 2 and above, the gateway has its own retry mechanism. It will retry failed messages four times by default, increasing the delay by 60 seconds each time. The default retry policy can be replaced.
Notifications
In versions 2 and above, the gateway does not provide error notifications. When an error occurs during sending of a message to other sites, the message will be retried and possibly moved to the error queue.
Note that in version 1, when subscribing to error notifications, the notification is received in the situation described above.
Backward compatibility migration
In order to send or publish messages to a Gateway version 1.x, it is required to set the TimeToBeReceived
and NonDurableMessage
headers as the Gateway 1.x receiver expects these headers to be present.
The following message mutator can be temporarily deployed until all Gateway 1.x endpoints are migrated to a newer major version.
// For Gateway version 3.x
public class AddRequiredHeadersForGatewayBackwardsCompatibility : IMutateOutgoingTransportMessages
{
public Task MutateOutgoing(MutateOutgoingTransportMessageContext context)
{
var headers = context.OutgoingHeaders;
headers.Add(Headers.TimeToBeReceived, TimeSpan.MaxValue.ToString());
headers.Add(Headers.NonDurableMessage, false.ToString());
return Task.CompletedTask;
}
}
// For Gateway version 2.x
public class AddRequiredHeadersForGatewayBackwardsCompatibility : IMutateOutgoingTransportMessages
{
public Task MutateOutgoing(MutateOutgoingTransportMessageContext context)
{
var headers = context.OutgoingHeaders;
headers.Add(Headers.TimeToBeReceived, TimeSpan.MaxValue.ToString());
headers.Add(Headers.NonDurableMessage, false.ToString());
return Task.CompletedTask;
}
}