SzymonPobiega / NServiceBus.Router

Cross-transport, cross-site and possibly cross-cloud router component for NServiceBus
MIT License
5 stars 10 forks source link

SqlSubscriptionStorage should use Func<Task<DbConnection>> #16

Closed markgould closed 5 years ago

markgould commented 5 years ago

SqlSubscriptionStorage currently takes a Func which is problematic when there is async work to be done (in my case, acquiring an Access Token). It would be better if it was a Func<Task>

The Sql Transport supports this (see UseCustomSqlConnectionFactory)

I'd be happy to submit a PR but naturally this would be a breaking change.

SzymonPobiega commented 5 years ago

@markgould the reason for this was that I copied the SQL persistence code to the Router and SQLP (for reasons unknown to me) uses Func<DbConnection>. I don't mind switching to Func<Task>. Let me see if it would be possible to do in a non-breaking way.

SzymonPobiega commented 5 years ago

@markgould I uploaded 3.5.0 which accepts either sync connection builder or an async one. The async version is expected to returned an already opened connection.

markgould commented 5 years ago

Looks great, thanks for implementing this so quickly!