using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;
using System.Windows.Forms;

namespace QueuedLibrary
{
   [InterfaceQueuing]
   public interface IQueuedComponent
   {
      void ProcessData(int numData);
   }

   public class SampleQueuedComponent : ServicedComponent, IQueuedComponent
   {
      public void ProcessData(int numData)
      {
         MessageBox.Show("Otrzymane dane z kolejki to: " +
            numData.ToString(), "Otrzymano dane");
      }
   }

   [Transaction(TransactionOption.Required,
      Isolation = TransactionIsolationLevel.Serializable,
      Timeout = 20)]
   public class TransactionalComponent : ServicedComponent
   {
      public void TransactionalMethod()
      {
         ContextUtil.MyTransactionVote = TransactionVote.Commit;
         try
         {
            // wykonaj zadanie
         }
         catch
         {
            ContextUtil.MyTransactionVote = TransactionVote.Abort;
         }
      }
   }

}
