예제 #1
0
 public override string ToString() => _activityPeriodDataBlock.ToString();
예제 #2
0
 public override string ToString() => _honoraireBlock.ToString();
예제 #3
0
 public override string ToString() => _specialPeriodDataBlock.ToString();
예제 #4
0
 public override string ToString() => _establishmentBlock.ToString();
예제 #5
0
        public void OnMessage(IDataBlock message)
        {
            // Handle incorrect protocol version.
            if (message is ProtocolInitiation)
            {
                string error = String.Format("Protocol mismatch - {0}", message.ToString());
                AMQException e = new AMQProtocolHeaderException(error);
                _log.Error("Closing connection because of protocol mismatch", e);
                //_protocolSession.CloseProtocolSession();
                _stateManager.Error(e);
                return;
            }

            AMQFrame frame = (AMQFrame)message;
            // Console.WriteLine(">>> AMQFrame frame received: " + frame); //KHC

            if (frame.BodyFrame is AMQMethodBody)
            {
                if (_log.IsDebugEnabled)
                {
                    _log.Debug("Method frame received: " + frame);
                }
                AMQMethodEvent evt = new AMQMethodEvent(frame.Channel, (AMQMethodBody)frame.BodyFrame, _protocolSession);
                try
                {
                    bool wasAnyoneInterested = false;
                    lock (_frameListeners.SyncRoot)
                    {
                        foreach (IAMQMethodListener listener in _frameListeners)
                        {
                            wasAnyoneInterested = listener.MethodReceived(evt) || wasAnyoneInterested;
                        }
                    }
                    if (!wasAnyoneInterested)
                    {
                        throw new AMQException("AMQMethodEvent " + evt + " was not processed by any listener.");
                    }
                }
                catch (Exception e)
                {
                    foreach (IAMQMethodListener listener in _frameListeners)
                    {
                        listener.Error(e);
                    }
                }
            }
            else if (frame.BodyFrame is ContentHeaderBody)
            {
                _protocolSession.MessageContentHeaderReceived(frame.Channel,
                                                              (ContentHeaderBody)frame.BodyFrame);
            }
            else if (frame.BodyFrame is ContentBody)
            {
                _protocolSession.MessageContentBodyReceived(frame.Channel,
                                                            (ContentBody)frame.BodyFrame);
            }
            else if (frame.BodyFrame is HeartbeatBody)
            {
                _log.Debug("HeartBeat received");
            }
            else
            {
                Console.WriteLine("***** UNHANDLED FRAME ******");
            }
        }
예제 #6
0
        public void OnMessage(IDataBlock message)
        {
            // Handle incorrect protocol version.
            if (message is ProtocolInitiation)
            {
                string       error = String.Format("Protocol mismatch - {0}", message.ToString());
                AMQException e     = new AMQProtocolHeaderException(error);
                _log.Error("Closing connection because of protocol mismatch", e);
                //_protocolSession.CloseProtocolSession();
                _stateManager.Error(e);
                return;
            }

            AMQFrame frame = (AMQFrame)message;

            // Console.WriteLine(">>> AMQFrame frame received: " + frame); //KHC

            if (frame.BodyFrame is AMQMethodBody)
            {
                if (_log.IsDebugEnabled)
                {
                    _log.Debug("Method frame received: " + frame);
                }
                AMQMethodEvent evt = new AMQMethodEvent(frame.Channel, (AMQMethodBody)frame.BodyFrame, _protocolSession);
                try
                {
                    bool wasAnyoneInterested = false;
                    lock (_frameListeners.SyncRoot)
                    {
                        foreach (IAMQMethodListener listener in _frameListeners)
                        {
                            wasAnyoneInterested = listener.MethodReceived(evt) || wasAnyoneInterested;
                        }
                    }
                    if (!wasAnyoneInterested)
                    {
                        throw new AMQException("AMQMethodEvent " + evt + " was not processed by any listener.");
                    }
                }
                catch (Exception e)
                {
                    foreach (IAMQMethodListener listener in _frameListeners)
                    {
                        listener.Error(e);
                    }
                }
            }
            else if (frame.BodyFrame is ContentHeaderBody)
            {
                _protocolSession.MessageContentHeaderReceived(frame.Channel,
                                                              (ContentHeaderBody)frame.BodyFrame);
            }
            else if (frame.BodyFrame is ContentBody)
            {
                _protocolSession.MessageContentBodyReceived(frame.Channel,
                                                            (ContentBody)frame.BodyFrame);
            }
            else if (frame.BodyFrame is HeartbeatBody)
            {
                _log.Debug("HeartBeat received");
            }
            else
            {
                Console.WriteLine("***** UNHANDLED FRAME ******");
            }
        }