You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new RebusConfigurer.Outbox StoreInSqlServer method overload that takes in Func<Task<IDbConnection>> connectionFactory instead of string connectionString
#100
Open
robpackwood opened this issue
May 11, 2023
· 3 comments
In both examples above StoreInSqlServer takes in Func for a connectionFactory parameter.
When configuring Outbox, the StoreInSqlServer() method is inconsistent with the methods mentioned above and could use an overload, which takes the same Func for a connectionFactory parameter. I would prefer to not store the database username and password in plain text for this connectionString and utilize the existing connectionFactory I already have in scope.
Oh yeah I can see that - it would of course be nice if the outbox configuration would accept the same connection factory as the other SQL Server configuration methods.
OK I just took a quick stab at it - it wasn't readily possible to fully implement it, because the current design of the outbox requires access to the raw SqlConnection/SqlTransaction objects.
@mookid8000do you think that it's possible to make IOutboxConnectionProvider public? For my use case (multi-tenant application) this is the last part to make it work (on the other hand, IOutboxStorage is publicly available).
EDIT: I meant only changing the modifier of the aforementioned interface, not considering these changes: master...feature/outbox-connection-factory. So, instead of configuring Outbox like this:
I could use a custom connection provider that dynamically resolves connection string and DB connection:
config.OtherService<IOutboxStorage>().Register(_ =>
new SqlServerOutboxStorage(MyCustomConnectionProvider, TableName));
//This doesn't work - IOutboxConnectionProvider is internal
config.OtherService<IOutboxConnectionProvider>().Register(_ =>
new MyCustomOutboxConnectionProvider());
EDIT2: I thought it behaves differently, but now I see other problems like outbox table initialization.
For Sagas, I configure with syntax like this:
For Timeouts, I configure with syntax like this:
In both examples above StoreInSqlServer takes in Func for a connectionFactory parameter.
When configuring Outbox, the StoreInSqlServer() method is inconsistent with the methods mentioned above and could use an overload, which takes the same Func for a connectionFactory parameter. I would prefer to not store the database username and password in plain text for this connectionString and utilize the existing connectionFactory I already have in scope.
Current code configuring the Outbox settings:
The text was updated successfully, but these errors were encountered: