Esempio n. 1
0
        public void RejectMessage(AmqpMessage message, Exception exception)
        {
            Rejected rejected = new Rejected();

            rejected.Error = AmqpError.FromException(exception);

            this.DisposeMessage(message, rejected, true, false);
        }
Esempio n. 2
0
 private void SendOpen()
 {
     base.TransitState("S:OPEN", StateTransition.SendOpen);
     if (base.TerminalException != null)
     {
         base.Settings.AddProperty("com.microsoft:open-error", AmqpError.FromException(base.TerminalException, true));
     }
     this.SendCommand(base.Settings, 0, null);
 }
Esempio n. 3
0
        private void SendClose()
        {
            base.TransitState("S:CLOSE", StateTransition.SendClose);
            Close close = new Close();

            if (base.TerminalException != null)
            {
                close.Error = AmqpError.FromException(base.TerminalException, true);
            }
            this.SendCommand(close, 0, null);
        }
Esempio n. 4
0
 public static AmqpException FromError(Microsoft.ServiceBus.Messaging.Amqp.Framing.Error error)
 {
     if (error == null || error.Condition.Value == null)
     {
         return(null);
     }
     if (error.Description != null)
     {
         return(new AmqpException(error, error.Description));
     }
     return(new AmqpException(AmqpError.GetError(error.Condition)));
 }
Esempio n. 5
0
        void SendClose()
        {
            this.TransitState("S:CLOSE", StateTransition.SendClose);
            Close close = new Close();

            if (this.TerminalException != null)
            {
                close.Error = AmqpError.FromException(this.TerminalException);
            }

            this.SendCommand(close, 0);
        }
Esempio n. 6
0
        protected AmqpObjectState SendEnd()
        {
            StateTransition stateTransition   = base.TransitState("S:END", StateTransition.SendClose);
            End             end               = new End();
            Exception       terminalException = base.TerminalException;

            if (terminalException != null)
            {
                end.Error = AmqpError.FromException(terminalException, true);
            }
            this.SendCommand(end);
            return(stateTransition.To);
        }
Esempio n. 7
0
        protected void SendEnd()
        {
            this.TransitState("S:END", StateTransition.SendClose);

            End       end       = new End();
            Exception exception = this.TerminalException;

            if (exception != null)
            {
                end.Error = AmqpError.FromException(exception);
            }

            this.SendCommand(end);
        }
Esempio n. 8
0
        private AmqpObjectState SendDetach()
        {
            StateTransition stateTransition = base.TransitState("S:DETACH", StateTransition.SendClose);
            Detach          detach          = new Detach()
            {
                Handle = this.LocalHandle,
                Closed = new bool?(true)
            };
            Exception terminalException = base.TerminalException;

            if (terminalException != null)
            {
                detach.Error = AmqpError.FromException(terminalException, true);
            }
            this.Session.SendCommand(detach);
            return(stateTransition.To);
        }
Esempio n. 9
0
        public static AmqpException FromError(Error error)
        {
            if (error == null || error.Condition.Value == null)
            {
                return(null);
            }

            if (error.Description == null)
            {
                Error amqpError = AmqpError.GetError(error.Condition);
                return(new AmqpException(amqpError));
            }
            else
            {
                return(new AmqpException(error, error.Description));
            }
        }
Esempio n. 10
0
        void SendDetach()
        {
            this.TransitState("S:DETACH", StateTransition.SendClose);

            Detach detach = new Detach();

            detach.Handle = this.LocalHandle;
            detach.Closed = true;
            Exception exception = this.TerminalException;

            if (exception != null)
            {
                detach.Error = AmqpError.FromException(exception);
            }

            this.Session.SendCommand(detach);
        }