Пример #1
0
        private void HandleMessageFrame(StompMessageFrame Frame)
        {
            StompMessageEventArgs e = new StompMessageEventArgs(Frame);

            // First, raise the event - catch it if the client code throws an exception and spit to console but don't crash
            try
            {
                MessageReceived(this, e);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            // Now reply with either NAck or Ack depending on what was set on the EventArgs
            if (e.SendNAck)
            {
                SendFrame(new StompNAckFrame(Frame));
            }
            else
            {
                SendFrame(new StompAckFrame(Frame));
            }
        }
Пример #2
0
        private void HandleMessageFrame(StompMessageFrame Frame)
        {
            StompMessageEventArgs e = new StompMessageEventArgs(Frame);

            // First, raise the event - catch it if the client code throws an exception and spit to console but don't crash
            try
            {
                MessageReceived(this, e);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }

            // Now reply with either NAck or Ack depending on what was set on the EventArgs
            if (e.SendNAck)
            {
                SendFrame(new StompNAckFrame(Frame));
            }
            else
            {
                SendFrame(new StompAckFrame(Frame));
            }
        }