Custom EntityFramework TimeOut Persistence in NSB 6.3

24 views
Skip to first unread message

Matt Ritchie

unread,
Sep 19, 2017, 11:24:01 PM9/19/17
to Particular Software
Helpful information to include
Product name: Upgrading from NSB 4.7.x to NSB 6.3
Version: 6.3
Description: 

Hi All,

I have a heap of NSB 4.7 non-saga services that use a custom entity framework timeout persistence which i'm trying to upgrade to NSB 6.3. 

These services used to be on NSB 2.5, which had access to the standalone timeout service which we used without problems. I think it was in V4 that timeouts were then pulled into the service. 

Those services were already using EF4, so it was simple to implement a class inheriting IPersistTimeouts, using some third-party blog post code as a starting point. This code's been running in production for nearly two years.

This was how i registered it in endpointconfig.cs
Configure.Features.Enable<TimeoutManager>();
config.Configurer.ConfigureComponent<TimeOutPersister>(DependencyLifecycle.SingleInstance);


I'm now attempting the upgrade to NSB 6.3 and am having trouble finding out where to start. 

The closest I've got so far is this.

configuration.EnableFeature<TimeoutManager>();
configuration.UsePersistence<ITimeoutPersistence, StorageType.Timeouts>(); //where ITimeoutPersistence : NServicebus.Persistence.PersistenceDefinition

But i can find no guidance on how to implement a class for PersistenceDefinition. SourceCode for existing definitions doesn't help explain it.

Has anybody attempted this with V6?

I thought that IPersistTimeouts didn't exist, but it does exist in 6.3.x. I just have no idea how to register it inside EndpointConfiguration.

Cheers,
Matt

Daniel Marbach

unread,
Sep 20, 2017, 11:08:08 AM9/20/17
to Particular Software
Hi Matt,

Is the code available on Github? I might be able to help you out a bit there to get you unstuck.

Have a look for example at the persistence definition of SqlPersistence https://github.com/Particular/NServiceBus.Persistence.Sql/blob/develop/src/SqlPersistence/SqlPersistence.cs

You then have feature implementations for every subtype you want to support like 


Hope that helps

Daniel

Matt Ritchie

unread,
Sep 20, 2017, 4:12:11 PM9/20/17
to Particular Software
Thanks! I'll give that shot.

Matt Ritchie

unread,
Sep 21, 2017, 5:00:28 AM9/21/17
to Particular Software
Pretty sure i'm going to cancel these plans to implement the persistence. We've been on .net 4.0 for years so are just starting to use Async, so i'll pass on attempting to implement.

I'm going to attempt to use the delivered sqlpersistence against my EF db. I'll use sql persistence which will create the scripts for me, I'll ensure then my EF table reflect it exactly. 

Fingers crossed..


On Thursday, September 21, 2017 at 1:08:08 AM UTC+10, Daniel Marbach wrote:
Reply all
Reply to author
Forward
0 new messages