Beispiel #1
0
        protected override void HandlePeekedMessage(OpenedQueue queue, Message message)
        {
            foreach (var action in transportActions)
            {
                if (action.CanHandlePeekedMessage(message) == false)
                {
                    continue;
                }

                try
                {
                    if (action.HandlePeekedMessage(this, queue, message))
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    logger.Error("Error when trying to execute action " + action + " on message " + message.Id + ". Message has been removed without handling!", e);
                    queue.ConsumeMessage(message.Id);
                }
            }

            if (consumeInTransaction)
            {
                ReceiveMessageInTransaction(queue, message.Id, MessageArrived, MessageProcessingCompleted, BeforeMessageTransactionCommit);
            }
            else
            {
                ReceiveMessage(queue, message.Id, MessageArrived, MessageProcessingCompleted);
            }
        }
 private void RemoveSubscriptionMessageFromQueue(OpenedQueue queue, string type, Uri uri)
 {
     subscriptionMessageIds.Write(writer =>
     {
         var key = new TypeAndUriKey
         {
             TypeName = type,
             Uri      = uri
         };
         IList <string> messageIds;
         if (writer.TryGetValue(key, out messageIds) == false)
         {
             return;
         }
         foreach (var msgId in messageIds)
         {
             queue.ConsumeMessage(msgId);
         }
         writer.Remove(key);
     });
 }
Beispiel #3
0
        protected override void HandlePeekedMessage(OpenedQueue queue,Message message)
        {
            foreach (var action in transportActions)
            {
                if(action.CanHandlePeekedMessage(message)==false)
                    continue;

                try
                {
                    if (action.HandlePeekedMessage(this, queue, message))
                        return;
                }
                catch (Exception e)
                {
                    logger.Error("Error when trying to execute action " + action + " on message " + message.Id + ". Message has been removed without handling!", e);
                    queue.ConsumeMessage(message.Id);
                }
            }
            ReceiveMessageInTransaction(queue, message.Id, MessageArrived, MessageProcessingCompleted);
        }
 private void RemoveSubscriptionMessageFromQueue(OpenedQueue queue, string type, Uri uri)
 {
     subscriptionMessageIds.Write(writer =>
     {
          var key = new TypeAndUriKey
          {
              TypeName = type,
              Uri = uri
          };
          IList<string> messageIds;
          if (writer.TryGetValue(key, out messageIds) == false)
              return;
          foreach (var msgId in messageIds)
          {
              queue.ConsumeMessage(msgId);
          }
          writer.Remove(key);
      });
 }