Saga correlation property type string limit of 200

In sql saga documentation here, it’s mentioned that for MS SQL Server, saga correlation property type string has Sql type of nvarchar(200).

Is there a way to modify this value for an existing saga in production?

Can / Should we manually alter the limitation?

We are on versions NServiceBus 7.2.4 and NServiceBus.Persistence.Sql 4.5.1 at the moment.

.

Do you mean can you modify the table to accept longer values? I think so.

But the real question is why do you need a correlation property that long? Correlation properties should be short identifiers, maybe even 2/3 identifiers mashed together, like CustomerId/{CustomerId}/OrderId/{OrderId}, but even if you were to mash together several Guids, you still wouldn’t hit 200 characters.

You probably shouldn’t be correlating sagas on text that’s longer than a Tweet. So, what’s your business case?

Thanks for the reply David.

I was worried what may happen if I modify the column length and then a later upgrade to NServiceBus attempts to re-alter it back in the future to be more precise.

In our business case, we are trying to correlate with a few fields as you mention, but cannot use guids in between services in this specific case. One of the fields is “organization name” coming from our customers and one of our customer has a painstakingly long organization name and broke the whole flow.

I am considering to move the correlation to a computed hash out of the stringified properties. It’s a saga with a handful of instances any given time, so I reckon hash computation overhead will be minimal impact.

That solution sounds reasonable. We do similar things inside NServiceBus now and then using NServiceBus/DeterministicGuid.cs at master · Particular/NServiceBus · GitHub

1 Like

Though if we had to do it all over we probably wouldn’t use MD5. :wink:

1 Like

And not use a cryptographic hash function :wink: