Пример #1
0
		private IMessage Run (MessageQueueTransactionType transactionType,
		                      RecieveDelegate r)
		{
			switch (transactionType) {
			case MessageQueueTransactionType.Single:
				using (RabbitMQMessageQueueTransaction tx = GetTx ()) {
					bool success = false;
					try {
						IMessage msg = Run (tx, r);
						tx.Commit ();
						success = true;
						return msg;
					} finally {
						if (!success)
							tx.Abort ();
					}
				}

			case MessageQueueTransactionType.None:
				return Run (r);

			default:
				throw new NotSupportedException(transactionType + " not supported");
			}
		}		
Пример #2
0
        private IMessage DoReceive(IMessageQueueTransaction transaction,
                                   TimeSpan timeout, IsMatch matcher, bool ack)
        {
            RabbitMQMessageQueueTransaction tx = (RabbitMQMessageQueueTransaction)transaction;

            return(DoReceive((IMessagingContext)tx, timeout, matcher, ack));
        }
Пример #3
0
        private IMessage DoReceive(MessageQueueTransactionType transactionType,
                                   TimeSpan timeout, IsMatch matcher, bool ack)
        {
            switch (transactionType)
            {
            case MessageQueueTransactionType.Single:
                using (RabbitMQMessageQueueTransaction tx = NewTx()) {
                    bool success = false;
                    try {
                        IMessage msg = DoReceive((IMessagingContext)tx, timeout, matcher, ack);
                        tx.Commit();
                        success = true;
                        return(msg);
                    } finally {
                        if (!success)
                        {
                            tx.Abort();
                        }
                    }
                }

            case MessageQueueTransactionType.None:
                return(DoReceive(timeout, matcher, true));

            default:
                throw new NotSupportedException(transactionType + " not supported");
            }
        }
Пример #4
0
		private IMessage Run (IMessageQueueTransaction transaction, 
		                      RecieveDelegate r)
		{
			TxReceiver txr = new TxReceiver (this, r);
			RabbitMQMessageQueueTransaction tx = 
				(RabbitMQMessageQueueTransaction) transaction;
			return tx.RunReceive (txr.ReceiveInContext);			
		}
Пример #5
0
		public void Send (IMessage msg, IMessageQueueTransaction transaction)
		{
			if (QRef == QueueReference.DEFAULT)
				throw new MonoMessagingException ("Path has not been specified");
			
			if (msg.BodyStream == null)
				throw new ArgumentException ("Message is not serialized properly");
			
			RabbitMQMessageQueueTransaction tx = (RabbitMQMessageQueueTransaction) transaction;
			
			tx.RunSend (SendInContext, msg);
		}
Пример #6
0
        public void Send(IMessage msg, IMessageQueueTransaction transaction)
        {
            if (QRef == QueueReference.DEFAULT)
            {
                throw new MonoMessagingException("Path has not been specified");
            }

            if (msg.BodyStream == null)
            {
                throw new ArgumentException("Message is not serialized properly");
            }

            RabbitMQMessageQueueTransaction tx = (RabbitMQMessageQueueTransaction)transaction;

            SetDeliveryInfo(msg, tx.Id);
            tx.Send(QRef, msg);
        }