private void Enlist(Transaction transaction) { if (transaction == null) { // no enlistment as we are not in a TransactionScope return; } // try to enlist as a PSPE if (!transaction.EnlistPromotableSinglePhase(this)) { // our enlistmente fail so we need to enlist ourselves as durable. // we create a transaction directly instead of using BeginTransaction that GraphClient // doesn't store it in its stack of scopes. var localTransaction = new Neo4jRestTransaction(client); localTransaction.ForceKeepAlive(); transactionId = localTransaction.Id; var resourceManager = GetResourceManager(); var propagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction); var transactionExecutionEnvironment = new TransactionExecutionEnvironment(client.ExecutionConfiguration) { TransactionId = localTransaction.Id, TransactionBaseEndpoint = client.TransactionEndpoint }; resourceManager.Enlist(transactionExecutionEnvironment, propagationToken); localTransaction.Cancel(); } enlistedInTransactions.Add(transaction); }
public void UserCanSetResourceManagerId() { var resourceManagerId = Guid.NewGuid(); var configuration = new ExecutionConfiguration {ResourceManagerId = resourceManagerId}; var executionEnvironment = new TransactionExecutionEnvironment(configuration); Assert.AreEqual(resourceManagerId, executionEnvironment.ResourceManagerId); }
private void Enlist(Transaction transaction) { if (transaction == null) { // no enlistment as we are not in a TransactionScope return; } // try to enlist as a PSPE if (!transaction.EnlistPromotableSinglePhase(this)) { // our enlistmente fail so we need to enlist ourselves as durable. // we create a transaction directly instead of using BeginTransaction that GraphClient // doesn't store it in its stack of scopes. var localTransaction = new Neo4jTransaction(_client); localTransaction.ForceKeepAlive(); _transactionId = localTransaction.Id; var resourceManager = GetResourceManager(); var propagationToken = TransactionInterop.GetTransmitterPropagationToken(transaction); var transactionExecutionEnvironment = new TransactionExecutionEnvironment(_client.ExecutionConfiguration) { TransactionId = localTransaction.Id, TransactionBaseEndpoint = _client.TransactionEndpoint }; resourceManager.Enlist(transactionExecutionEnvironment, propagationToken); localTransaction.Cancel(); } _enlistedInTransactions.Add(transaction); }
public void ResourceManagerIdDefaultValueIsSet() { var configuration = new ExecutionConfiguration(); var executionEnvironment = new TransactionExecutionEnvironment(configuration); Assert.AreEqual(configuration.ResourceManagerId, executionEnvironment.ResourceManagerId); }