github Particular/NServiceBus 5.0.0

latest releases: 9.0.0, 9.0.0-alpha.10, 8.1.6...
9 years ago

Upgrade Guide from v4 to v5

http://docs.particular.net/nservicebus/upgradeguides/4to5

As part of this release we had 97 issues closed.

Features

#2356 Add XmlMessageSerializer support for generic types.

#1605 Split RavenDB from the core and add support for RavenDB 2.5

In order to better follow the release cycle of RavenDB, the RavenDB functionality has been removed from the core into its own repository https://github.com/Particular/NServiceBus.RavenDB and nuget
https://www.nuget.org/packages/NServiceBus.RavenDB

#1604 Pull the distributor out of the core

Moved to a separate repo https://github.com/Particular/NServiceBus.Distributor.Msmq and NuGet https://www.nuget.org/packages/NServiceBus.Distributor.MSMQ/

#1555 Non-DTC operations

In order to provide the same level of consistency as users that are running with DTC transactions enabled we should introduce a mode of operations that provides those same guarantees without requiring a DTC compliant transport and storage.

The following is the high-level design

When a message is pulled from the Q
  • if IncomingMessage.MessageId exists in the outbox
    • no: Record all actions (keep them inmemorybatch them to storage at end of "inner" transaction)
      * Note that message id will be generated here and kept stable
    • yes: dispatch all message actions (since this is a retry) but don't invoke user code

Content trimmed. See full issue

Improvements

#2330 Provide saga type name when logging a SagaNotFound message

#2328 Introduce ISendOnlyBus

To simplify the api by not exposing IBus methods not relevant for a sendonly bus

#2327 Introduce Bus.Create(new BusConfiguration())

#2288 Move IConfigureThisEndpoint out of the core

#2282 Container.RegisterSingleton should take an instance of T not an object

#2261 Moved Roles into the Host

The extension points IConfigureRole, IConfigureRole<T> and IRole no longer exist.

AsA_Client and AsA_Server can still be used.

AsA_Publisher has been deprecated and should be replaced with AsA_Server

#2244 Remove Bus.CreateInstance

So where previously this was used

Bus.Publish(Bus.CreateInstance<OrderCancelled>(o =>
    {
        o.OrderNumber = message.OrderNumber;
        o.ClientId = message.ClientId;
    }));

Now this is used

Bus.Publish<OrderCancelled>(o =>
    {
        o.OrderNumber = message.OrderNumber;
        o.ClientId = message.ClientId;
    });

#2229 Improve error reporting in TimeoutPersisterReceiver

When the timeout persister logs a warning about a failure it will now include the exception in the log entry

#2168 Remove UnicastBus.Start(Action)

The Action parameter overload of UnicastBus.Start(Action)` has been removed

#2167 Remove ForInstallationOn, Windows and IEnvironment

This was an overly complex approach to running installers. As such it has been simplified

#2137 Make ConfigureHowToFindSaga abstract

Too many people forget to override this method. As such it will now be abstract.

#2136 Remove empty constructor requirement from Saga

by using FormatterServices.GetUninitializedObject

#2113 Merge the Core

The NSB interfaces dll was created to allow people to have a smaller dependency when creating a messages assembly. With the introduction of unobtrusive messages that is no longer required. As such NServiceBus.dll will be merged into NServiceBus.Core.dll. Also the NServiceBus.Interfaces nuget will be deprecated.

#2105 Change IMessageSerializer.Serialize to take a single message

In version 5 multi-message sends is being removed. So serialization of an array of messages is no longer required.

Note that deserialization to an array is still required for backwards compatibility with earlier versions of NSB

#2104 Obsolete SerializationSettings WrapSingleMessages and DontWrapSingleMessages

In version 5 multi-message sends is being removed. So Wrapping messages is no longer required. It only remains for compatibility with 3.0 endpoints

#2102 Standardise extension methods to configure persistences

#2097 Remove UnicastBus.NoSubscribersForMessage event

#2095 replace ISaga with non generic base class "Saga"

ISaga looks like an extension point. But in reality it is an internal concern which allows the framework to gain access to a non-generic version of the sagadata. See #1762

So ISaga (#1762) and ISaga<T> (#1765) were obsoleted

The replacement for the is a non-generic base class Saga. This class is a legitimating extension point, although most scenarios would still use Saga<T>. All functionality of Saga<T> will be pushed up to Saga. Saga<T> will now inherit from Saga.

#2093 remove MessageIntentEnum.Init

#2091 remove IPersistSagas

Not used for anything.

#2090 Remove IConfigurable interface on Saga

With the removal of ISaga and ISaga<T> the IConfigurable interface is redundant.

#2088 Remove Bus.Subscribe Predicate overloads

Since the Predicate is executed at the subscriber side it is not efficient. Also this is a confusing API since
consumer often, incorrectly, believe it is publisher side filtering. Instead create a Handler that does this
filtering logic and then, optionally, calls DoNotContinueDispatchingCurrentMessageToHandlers. This
Handler should be ordered to run before other handlers.

related to #1546

#2084 InMemory transport removal

#2082 Remove this.Bus() extension method for IHandleMessages implementations

#2081 Remove impersonation

#2078 Move to .net 4.5

The reasons for doing this are as follows

  • Allows some better optimization in the core via the use of new APIs provided in 4.5
  • Some of our Satellite dependencies are already moving 4.5. For example Unity
  • 4.5 was release in mid 2012 so it has been out for reasonable amount of time
  • Less testing surface area
  • Also allows us to take advantages of the other various improvements in 4.5 http://msdn.microsoft.com/en-us/library/ms171868(v=vs.110).aspx#core

What this means for consumers

  • The new minimum Visual Studio version will be Visual Studio 2012
  • The new minimum server OS will be 2008
  • The new minimum desktop OS will be Vista SP2
  • All assemblies (and nugets) that depend on the core will be upgraded to 4.5

Note the earlier versions of NServiceBus will still be compatible and supported for .net 4

For more information on .net 4.5 see

#2070 better handling of missing Feature.Enable

so if a user forgets to have this line Feature.Enable<Sagas>(); but still has a saga no guidance is given as to why that saga is not executed

In fact there is misinformation

Could not find a saga for the message type "Message1". Going to invoke SagaNotFoundHandlers.

#1989 Performance is slow while debugger is attached

#1863 Set DoNotWrapHandlersExecutionInATransactionScope automatically when Disabling transactions

When you call Disable on transactions, your call is still wrapped in a transactionscope

So to get rid of all transactional behavior you need to do both

Configure.Transactions.Advanced(a => a.DoNotWrapHandlersExecutionInATransactionScope());
Configure.Transactions.Disable();

Would be better to remove the scope automatically

#1857 ReturnToSourceQueue error message incorrectly formatted

Fix the incorrect message:

No message found with ID 'NServiceBus.MessageId'. Going to check headers of all messages for one with 'NServiceBus.MessageId' or 'NServiceBus.CorrelationId'.

#1791 Remove DelegateFactory

#1707 Remove UnicastBus.DisableMessageHandling

#1603 Pull the gateway out of the core

Since the gateway is a optional component we should pull it out of the core and auto enable it if users reference it.

#1554 Configure.Transaction.Disable() => Don't use a transaction scope by default

If one configures the Bus with

Configure.Transactions.Disable();

then no transactions should be used at all (at least I understand this that way).

But even if Transactions are disabled, the MsmqDequeueStrategy calls TransportReceiver.TryProcess(TransportMessage): bool which starts a new Transaction scope.

This behavior can currently be fixed, if one set explicitly

Configure.Transactions.Disable(s => s.DoNotWrapHandlersExecutionInATransactionScope());

Content trimmed. See full issue

#1416 Split custom logging framework support into diff repos and nugets

https://github.com/Particular/NServiceBus.NLog
https://github.com/Particular/NServiceBus.Lo4Net

#1367 Remove actions in Bus.Start()

The startupAction parameter of UnicastBus.Startsimply executed the action immediately before the actual start of the bus. This provided no real value since a consumer can simply execute said action prior to calling Start.

#1366 Remove .RunCustomAction()

#1346 Obsolete sending and publishing batches of messages together in a single call

Each of the messaging APIs that involve multiple messages on IBus have been removed. Below is the table on how to replace these.

Old Method Replacement Method
Publish(T[] messages); Publish(T message);
SendLocal(object[] messages); SendLocal(object message);
Send(object[] messages); Send(object message);
Send(string destination, object[] messages); Send(string destination, object message);
Send(Address address, object[] messages); Send(Address address, object message);
Send(string destination, string correlationId, object[] messages); Send(string destination, string correlationId, object message);
SendToSites(IEnumerable siteKeys, object[] messages); SendToSites(IEnumerable siteKeys, object message);
Defer(TimeSpan delay, object[] messages); Defer(TimeSpan delay, object message);
Defer(DateTime processAt, object[] messages); Defer(DateTime processAt, object message);
Reply(object[] messages); Reply(object message);

#1035 Introduce a NServiceBus.EndpointVersion header

To capture the version of the users endpoint that is running. Extract the current code (used in side by side mode in the host) and make it available on the core.

New api in v5
var configuration = new BusConfiguration();
configuration.EndpointVersion("1.2.1"))

#948 Remove IUnicastBus

Replacement is IBus

#928 Separate RavenDB support to a separate assembly

RavenDB has been split out of the core to a separate NServiceBus.RavenDB assembly. This new assembly targets RavenDB 2.5. Please see docs.particular.net for more information

#779 The order where DefineEndpointName is specified in the fluent API should not matter

The new api requires the endpoint name to be specified up front:

configuration.EndpointName("someName");

#751 Remove MsmqTransportConfig completely

Replacement is TransportConfig section instead

#450 Throw excepton if IWantCustomInitialization is used in the wrong location

Throw an exception if IWantCustomInitialization is used on anything which doesn't also implement IConfigureThisEndpoint.

Bugs

#2395 Log for publishing events doesn't include target endpoint.

#2374 DefaultRetryPolicy.NumberOfRetries and DefaultRetryPolicy.TimeIncrease are static

Which means they are global (last one wins) across all bus instances

#2329 PerformanceMonitorUsersInstaller is broken for non english OSs

In PerformanceMonitorUsersInstaller we have hardcoded the group name to "Performance Monitor Users", which means that for non English OSs, that will not work.

See

var startInfo = new ProcessStartInfo
{
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardError = true,
Arguments = string.Format("localgroup \"Performance Monitor Users\" \"{0}\" /add", identity),
FileName = "net",
WorkingDirectory = Path.GetTempPath()

#2226 IgnoreMachineName flag is not taken into account when calculating hashcode

#1909 NServiceBus fails to shut down if IWantToRunWhenBusStartsAndStops.Start throws

#1875 NullReferenceException when doing a send and no mapping is configured

This case is now explicitly detected and a better exception will be thrown.

#1736 log4net NullReferenceExceptions

In Version 5 log4net is no longer embedded inside NServiceBus

#1661 NinjectObjectBuilder.ConfigureProperty won't replace property binding when multiple configs are applied

So now this code

builder.ConfigureProperty(typeof(DuplicateClass), "SomeProperty", false);
builder.ConfigureProperty(typeof(DuplicateClass), "SomeProperty", true); // this should remove/override the previous property setting

Will result in SomeProperty being injected as true

#1506 ProfileManager logger is initialised to NullLogger before custom loggerfactory is set up

Version 5 now has sensible defaults for logging. So logging will still occur from ProfileManager even if logging is not yet configured.

#1486 DefaultConfigurationSource.GetConfiguration called before IWantToRunBeforeConfiguration

In Version 5 reading of the logging config bypasses IConfigurationSource and goes directly to ConfigurationManager.GetSection

#1485 NLog cannot accept values from config file

#1372 When using NServiceBus.Host and using CustomInitialization to start the endpoint as SendOnly, the host throws configuration errors

#1284 Default log file name does not have a ".txt" extension

#800 Remove obligation that PurgeOnStartup needs to be specified before specifying any transport

#297 NServiceBus.Host Endpoint name is ignored when configuring endpoint.

Remove the ordering issues that can result in endpoint name being ignored

Where to get it

You can download this release from nuget

Don't miss a new NServiceBus release

NewReleases is sending notifications on new releases.