-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EnlistTransaction fails starting saga when using SqlAzure #244
Comments
When enabling Outbox against SqlAzure NServiceBus shows:
I'd expect no DTC enabled on SqlAzure, but: |
@brunobertechini Thanks for reporting this. Where are you hosting your saga? Is it within the same App Service or elsewhere? Also, are you using a single Azure SQL Database for both the transport and persistence? |
@MarcinHoppe I am using the same SqlAzure for Transport and Persistence. I am hosting the endpoint using Azure WebJobs (self hosted) in the same AppService And I am also using NHibernate.SqlAzure driver |
@brunobertechini Can you post the configuration of all your endpoints with the sensitive parts redacted? Are all the connection strings exactly the same? |
@brunobertechini Are you still experiencing this issue? |
Yes I am.. here is my endpoint config: All connection strings are the same.
|
@brunobertechini How does your custom unit of work behavior look like? Does it interact with the database in any way? |
Yes. It starts the custom UoW and calls next(); and commit UnitOfWork (EF6) after next
|
Should I have one database catalog specific for queues (separated from business data) ? By reading SqlTransport Deployment Options it seems multi-instance/catalog is deprecated:
|
My goal is to import third-party data for processing. New Entities from a third party provider. I have a restriction on how many calls I can make and also im worried about performance issues: For example if I have 2000 entities to import i need to do 20 calls (100 entities each - api restriction) and publish an event for each one. The problem is, for each entity I need to call another api method to mark the entity as imported/processed. That makes 40 calls to thirdpary api. But since the SetAsImported call might fail, I cant do that inside one single handler. And im sending commands to SetAsImported to another handlers. That way I will have 100 inserts for business data and 100 commands going out. All persisted to SqlAzure. Bruno |
@brunobertechini Is your EF data in the same database? If it is, please make sure that you follow the trick described here to avoid DTC escalation when using EF: https://docs.particular.net/nservicebus/sqlserver/entity-framework If your EF data is in another database, then you might have to create a new Does this help? |
They are all in the same database for now. Considering split. If I does not escalate to DTC will I have all messages and business data being processed inside a handler to act as one single transaction from unit of work ? I.e.: will all rollback together if either business data and/or messages fail to be processed? |
Im using EF6 code first and the context is being injected by Aspnetboilerplate library. I dont see enough info in that link to "share" ef connection. As per my understanding this states that NHibernate and EF6 must share the sabe DBConnection to participate in the transaction right ? Bruno |
@brunobertechini That's a lot of questions and I think they go beyond the original issue 😄. Would you mind posting these questions to support@particular.net? I think it will be easier for us to resolve your issue through that channel. Thanks! |
@brunobertechini You can CC me (marcin.hoppe at particular.net) and I will get at it directly. Thanks! |
👍 Can you just shed some light at this one As per my understanding the link above (for EF Caveats) states that NHibernate and EF6 must share the same DBConnection to participate in the transaction to avoid the exception mentioned in the first comment? I.E.: avoid escalating to DTC ? What I would like to know is if the exception mentioned above is because the transport is trying to escalate to DTC. |
I think the architecture here could be simplified to achieve the same goal of having transactional consistency between the transport, EF context and sagas.
Does this make sense? I will still try to replicate this solution to see if I can get the same exception. |
I smoke tested the Sql Transport, NHibernate and EF sample without Outbox against a single Azure SQL Database for transport, persistence and business data. It worked fine and I observed no DTC escalation. @brunobertechini Did my last response help in any way? Have you created the support case where I could chime in? |
@MarcinHoppe sorry didnt have time to go deeper on this matter. I will create a reproduction of this code. I am pretty sure this is related to AspNetBoilerplate framework and how it handles EF transactions. Bruno |
@brunobertechini did you manage to reproduce this? |
I am closing this issue for now because we don't have any new information that would allow us to get any closer to reproducing this. @brunobertechini Don't hesitate to re-open this issue if you have more information. |
I am not sure if this is the same problem from this issue #201 .
Scenario:
And this fails with exception:
The text was updated successfully, but these errors were encountered: