Today we have an NServiceBus host that will invoke a WCF service (legacy) to do some work, and the transaction scope does not span the WCF service call. If the WCF service fails, NServiceBus will fail and go through its normal retry process that we’ve configured. If the WCF service succeeds but the NServiceBus host fails (maybe due to timeout or service interrupt), we’ve had to implement our server-side logic to be idempotent. Our team is looking to start migrating code out of the WCF service and into the NServiceBus handler, but the default transaction scope in NServiceBus can be problematic for scenarios where we aggressively control the transaction lifetime:
1. foreach(file in directory) => { using TransactionScope(); Bus.Send(new command { file }); MoveFile(file); TransactionScope.Complete(“start processing file in another thread”); }
2. DoX(); IdempotentDataAccess(); TransactionScope.Complete(“avoid long running db transactions”); DoTimeConsumingWorkY();
With each of these scenarios running in a separate process (WCF service), we can granularly control transaction boundaries for these edge cases without fear of losing messages on the NServiceBus side. If we migrate our business logic to run within the NServiceBus project, and we want to keep the same transaction model, I’m assuming we need to start playing with some of these configuration options. One of my goals with this thread is to understand if the durability of the messages (MSMQ transport) will be impacted by using these settings (e.g. what happens to the message if we are running with disabled transactionscope option, and the NServiceBus host shuts off mid-process… does it stay in queue? is the message lost?).
By the way, for #2, I realize we can move “DoTimeConsumingWorkY()” to its own queued message and then we don’t need to complete the transactionscope ourselves. For the sake of deepening my understanding of NServiceBus transaction management + MSMQ, I’d like to shelve any refactor suggestions and instead understand consequences of using the transaction-related configuration options.
--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/396aa4e9-52b8-49cb-9a3e-5e0e06855e32%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public sealed class EndpointConfig : IConfigureThisEndpoint, IWantToRunBeforeConfiguration, AsA_Server
Hi,
--
You received this message because you are subscribed to the Google Groups "Particular Software" group.
To unsubscribe from this group and stop receiving emails from it, send an email to particularsoftw...@googlegroups.com.
To post to this group, send email to particula...@googlegroups.com.
Visit this group at http://groups.google.com/group/particularsoftware.
To view this discussion on the web visit https://groups.google.com/d/msgid/particularsoftware/59bd77c9-cec0-45df-abbc-0eb0c246bbf4%40googlegroups.com.