INetTxSession.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one or more
  3. * contributor license agreements. See the NOTICE file distributed with
  4. * this work for additional information regarding copyright ownership.
  5. * The ASF licenses this file to You under the Apache License, Version 2.0
  6. * (the "License"); you may not use this file except in compliance with
  7. * the License. You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. */
  17. #if !NETCF
  18. using System.Threading.Tasks;
  19. using System.Transactions;
  20. #endif
  21. namespace Apache.NMS
  22. {
  23. /// <summary>
  24. /// The INetTxSession interface extends the capability of Session by adding access to a NMS
  25. /// provider's support for the Distributed Transactions (optional). The transaction support
  26. /// leverages the .NET Frameworks System.Transactions API.
  27. ///
  28. /// The NMS Provider implements this interface by participating in the current ambient transaction
  29. /// as defined by the System.Transactions.Transaction.Current static member. Whenever a new
  30. /// Transaction is entered the NMS provider should enlist in that transaction. When there is no
  31. /// ambient transaction then the NMS Provider should allow the INetTxSession instance to behave
  32. /// as a session that is in Auto Acknowledge mode.
  33. ///
  34. /// Calling the Commit or Rollback methods on a INetTxSession instance should throw an exception
  35. /// as those operations are controlled by the Transaction Manager.
  36. ///
  37. /// The INetTxSession interface is optional. NMS providers are not required to support this
  38. /// interface. This interface is for use by NMS providers to support transactional environments.
  39. /// </summary>
  40. public interface INetTxSession : ISession
  41. {
  42. #if !NETCF
  43. /// <summary>
  44. /// Enlist the Session in the specified Transaction.
  45. ///
  46. /// If the Session is already enlisted in a Transaction or there is an Ambient
  47. /// Transaction and the given TX is not that Transaction then an exception should
  48. /// be thrown.
  49. /// </summary>
  50. void Enlist(Transaction tx);
  51. /// <summary>
  52. /// Enlist the Session in the specified Transaction.
  53. ///
  54. /// If the Session is already enlisted in a Transaction or there is an Ambient
  55. /// Transaction and the given TX is not that Transaction then an exception should
  56. /// be thrown.
  57. /// </summary>
  58. Task EnlistAsync(Transaction tx);
  59. bool EnlistsMsDtcNativeResource { get; set; }
  60. #endif
  61. }
  62. }