/**
         * Called from the AMQSession when a message has arrived for this consumer. This methods handles both the case
         * of a message listener or a synchronous receive() caller.
         *
         * @param messageFrame the raw unprocessed mesage
         * @param channelId    channel on which this message was sent
         */
        internal void NotifyMessage(UnprocessedMessage messageFrame, int channelId)
        {
            if (_logger.IsDebugEnabled)
            {
                _logger.Debug("notifyMessage called with message number " + messageFrame.DeliverBody.DeliveryTag);
            }
            try
            {
                AbstractQmsMessage jmsMessage = _messageFactory.CreateMessage((long)messageFrame.DeliverBody.DeliveryTag,
                                                                              messageFrame.DeliverBody.Redelivered,
                                                                              messageFrame.ContentHeader,
                                                                              messageFrame.Bodies);

                _logger.Debug("Message is of type: " + jmsMessage.GetType().Name);

                PreDeliver(jmsMessage);

                if (IsMessageListenerSet)
                {
                    // We do not need a lock around the test above, and the dispatch below as it is invalid
                    // for an application to alter an installed listener while the session is started.
#if __MonoCS__
                    _messageListener(jmsMessage);
#else
                    _messageListener.Invoke(jmsMessage);
#endif
                    PostDeliver(jmsMessage);
                }
                else
                {
                    _messageQueue.Enqueue(jmsMessage);
                }
            }
            catch (Exception e)
            {
                _logger.Error("Caught exception (dump follows) - ignoring...", e); // FIXME
            }
        }
Exemplo n.º 2
0
 public void OnMessageReceived(long epoch, byte[] message, int set, ConnectionType connectionType)
 {
     MessageReceived?.Invoke(epoch, message, set, connectionType);
 }
 public void OnMessageReceived(string connection, long epoch, byte[] message)
 {
     MessageReceived?.Invoke(connection, epoch, message);
 }
Exemplo n.º 4
0
 public void OnMessageReceived(long epoch, byte[] message, int set)
 {
     MessageReceived?.Invoke(epoch, message, set);
 }