Esempio n. 1
0
            /// <summary>
            /// End enqueuing messages with transaction style. Currently, total size of queued messages must be less than 4 G bytes
            /// </summary>
            /// <param name="rollback">true for rollback, and false for committing</param>
            /// <param name="qt">A callback for tracking returning error code, which can be one of QUEUE_OK, QUEUE_TRANS_NOT_STARTED_YET, and so on</param>
            /// <param name="discarded">a callback for tracking cancel or socket closed event</param>
            /// <returns>true for sending the request successfully, and false for failure</returns>
            public virtual bool EndQueueTrans(bool rollback, DQueueTrans qt, DDiscarded discarded)
            {
                bool ok = SendRequest(idEndTrans, rollback, (ar) =>
                {
                    if (qt != null)
                    {
                        int errCode;
                        ar.UQueue.Load(out errCode);
                        qt((CAsyncQueue)ar.AsyncServiceHandler, errCode);
                    }
                    else
                    {
                        ar.UQueue.SetSize(0);
                    }
                }, discarded, (DOnExceptionFromServer)null);
                IClientQueue cq = AttachedClientSocket.ClientQueue;

                if (cq.Available)
                {
                    if (rollback)
                    {
                        cq.AbortJob();
                    }
                    else
                    {
                        cq.EndJob();
                    }
                }
                return(ok);
            }
Esempio n. 2
0
            /// <summary>
            /// Start enqueuing messages with transaction style. Currently, total size of queued messages must be less than 4 G bytes
            /// </summary>
            /// <param name="key">An ASCII string for identifying a queue at server side</param>
            /// <param name="qt">A callback for tracking returning error code, which can be one of QUEUE_OK, QUEUE_TRANS_ALREADY_STARTED, and so on</param>
            /// <returns>true for sending the request successfully, and false for failure</returns>
            public bool StartQueueTrans(byte[] key, DQueueTrans qt)
            {
                IClientQueue cq = AttachedClientSocket.ClientQueue;

                if (cq.Available)
                {
                    cq.StartJob();
                }
                using (CScopeUQueue sq = new CScopeUQueue())
                {
                    sq.UQueue.Save(key);
                    return(SendRequest(idStartTrans, sq, (ar) =>
                    {
                        if (qt != null)
                        {
                            int errCode;
                            ar.UQueue.Load(out errCode);
                            qt((CAsyncQueue)ar.AsyncServiceHandler, errCode);
                        }
                        else
                        {
                            ar.UQueue.SetSize(0);
                        }
                    }));
                }
            }
Esempio n. 3
0
 /// <summary>
 /// End enqueuing messages with transaction style. Currently, total size of queued messages must be less than 4 G bytes
 /// </summary>
 /// <param name="rollback">true for rollback, and false for committing</param>
 /// <param name="qt">A callback for tracking returning error code, which can be one of QUEUE_OK, QUEUE_TRANS_NOT_STARTED_YET, and so on</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool EndQueueTrans(bool rollback, DQueueTrans qt)
 {
     return SendRequest(idEndTrans, rollback, (ar) =>
     {
         if (qt != null)
         {
             int errCode;
             ar.Load(out errCode);
             qt(errCode);
         }
         else
         {
             ar.UQueue.SetSize(0);
         }
     });
 }
Esempio n. 4
0
 /// <summary>
 /// Start enqueuing messages with transaction style. Currently, total size of queued messages must be less than 4 G bytes
 /// </summary>
 /// <param name="key">An ASCII string for identifying a queue at server side</param>
 /// <param name="qt">A callback for tracking returning error code, which can be one of QUEUE_OK, QUEUE_TRANS_ALREADY_STARTED, and so on</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool StartQueueTrans(byte[] key, DQueueTrans qt)
 {
     if (key == null)
         key = new byte[0];
     using (CScopeUQueue sq = new CScopeUQueue())
     {
         sq.UQueue.Save(key);
         return SendRequest(idStartTrans, sq, (ar) =>
         {
             if (qt != null)
             {
                 int errCode;
                 ar.Load(out errCode);
                 qt(errCode);
             }
             else
             {
                 ar.UQueue.SetSize(0);
             }
         });
     }
 }
Esempio n. 5
0
 /// <summary>
 /// End enqueuing messages with transaction style. Currently, total size of queued messages must be less than 4 G bytes
 /// </summary>
 /// <param name="rollback">true for rollback, and false for committing</param>
 /// <param name="qt">A callback for tracking returning error code, which can be one of QUEUE_OK, QUEUE_TRANS_NOT_STARTED_YET, and so on</param>
 /// <returns>true for sending the request successfully, and false for failure</returns>
 public bool EndQueueTrans(bool rollback, DQueueTrans qt)
 {
     return(EndQueueTrans(rollback, qt, null));
 }