Exemplo n.º 1
0
        public IBTDTCCommitConfirm Done(object transaction)
        {
            //BT.Trace.Tracer.TraceMessage(BT.TraceLevel.SegmentLifeTime, "CoreAdapter: Entering Batch.Done");

            try
            {
                if (_workToBeDone)
                {
                    IBTDTCCommitConfirm commitConfirm = _transportBatch.Done(transaction);
                    return(commitConfirm);
                }
                else
                {
                    // This condition should never occur on the production box
                    // (unless there is a product bug). So, this string need not be localized
                    Exception ex = new InvalidOperationException("Adapter is trying to submit an empty batch to EPM. Source = " +
                                                                 GetType());
                    _transportProxy.SetErrorInfo(ex);
                    throw ex;
                }
            }
            finally
            {
                //  undo cyclical reference through COM
                Dispose();

                //BT.Trace.Tracer.TraceMessage(BT.TraceLevel.SegmentLifeTime, "CoreAdapter: Leaving Batch.Done");
            }
        }
        public void Done(IBTDTCCommitConfirm commitConfirm)
        {
            if (this.messages.Count == 0)
            {
                Exception ex = new InvalidOperationException("Send adapter received an emtpy batch for transmission from BizTalk");
                this.transportProxy.SetErrorInfo(ex);

                return;
            }

            //  The Enter/Leave is used to implement the Terminate call from BizTalk.

            //  Do an "Enter" for every message
            int MessageCount = this.messages.Count;
            for (int i = 0; i < MessageCount; i++)
            {
                if (!this.asyncTransmitter.Enter())
                    throw new InvalidOperationException("Send adapter Enter call was false within Done. This is illegal and should never happen."); ;
            }

            try
            {
                new WorkerDelegate(Worker).BeginInvoke(null, null);
            }
            catch (Exception)
            {
                //  If there was an error we had better do the "Leave" here
                for (int i = 0; i < MessageCount; i++)
                    this.asyncTransmitter.Leave();
            }
        }
Exemplo n.º 3
0
        public void Done(IBTDTCCommitConfirm commitConfirm)
        {
            if (this.messageList.Count == 0)
            {
                Exception ex = new InvalidOperationException("Send adapter received an emtpy batch for transmission from BizTalk");
                this.transportProxy.SetErrorInfo(ex);

                return;
            }

            //  The Enter/Leave is used to implement the Terminate call from BizTalk.

            //  Do an "Enter" for every message
            int MessageCount = this.messageList.Count;

            for (int i = 0; i < MessageCount; i++)
            {
                if (!this.control.Enter())
                {
                    throw new InvalidOperationException("Send adapter Enter call was false within Done. This is illegal and should never happen.");
                }
                ;
            }

            try
            {
                //  we now have been given a list of messages so jump of BizTalk's thread and start sending them.
                this.worker.BeginInvoke(null, null);
            }
            catch (Exception)
            {
                //  If there was an error we had better do the "Leave" here
                for (int i = 0; i < MessageCount; i++)
                {
                    this.control.Leave();
                }
            }
        }
        public void Done(IBTDTCCommitConfirm commitConfirm)
        {
            if (_messages.Count == 0)
            {
                Exception ex = new InvalidOperationException("Send adapter received an emtpy batch for transmission from BizTalk");
                _transportProxy.SetErrorInfo(ex);

                return;
            }

            //  The Enter/Leave is used to implement the Terminate call from BizTalk.

            //  Do an "Enter" for every message
            int messageCount = _messages.Count;

            for (int i = 0; i < messageCount; i++)
            {
                if (!_asyncTransmitter.Enter())
                {
                    throw new InvalidOperationException("Send adapter Enter call was false within Done. This is illegal and should never happen.");
                }
            }

            try
            {
                new WorkerDelegate(Worker).BeginInvoke(null, null);
            }
            catch (Exception)
            {
                //  If there was an error we had better do the "Leave" here
                for (int i = 0; i < messageCount; i++)
                {
                    _asyncTransmitter.Leave();
                }
            }
        }