1
votes

I'd like to refactor some of my sagas and messages and move them to a new namespace.

I can't clear out the existing worker queues and need to have the old saga/messages still work until they are all gone.

I won't be changing any behaviour of the saga/messages just the namespace, is there an easy way to bulk update these so that the old saga/messages can continue to process correctly.

What things do I need to worry about here, is it possible to do this?

1
What persistence do you use?Sean Feldman

1 Answers

0
votes

I'm not sure if there's any way you can blanket update all the in-flight saga instances. I imagine you might be able to with some Raven-fu (or SQL if you're using that).

The problem is that NServiceBus uses the fully qualified name of the message type to identify it for routing purposes, so it's a complex problem and something you'd want to get right first time.

In effect, what you're talking about doing is introducing a whole load of new messages into your architecture. It may be safer to introduce the change in parallel, allow all in-flight saga instances to complete, and then decommission the obsolete - and now unused - bits.

NSB documentation has this to say about handling breaking changes, though nothing specific to in-flight sagas...

When there are significant changes in a message type, such as adding or removing property, changing the property type, etc. the upgrade process should consist of the following steps:

  • Update contract to the new version.
  • Update senders to use the new contract version. Ensure changes are visible for receivers, such as: Decorate the existing property with Obsolete attribute with a warning when removing or renaming properties.
  • Update receivers to handle the new contract version. Make sure the new properties are handled correctly, e.g. instead of relying on .NET to set the default value for int Age = 1, it's better to use nullable types and represent missing values as null.
  • When all senders and receivers are updated and in-flight messages in the old format have been handled, obsolete the properties and throw an error, or simply remove them.