当前位置: 首页>>代码示例>>C#>>正文


C# OpenedQueue.TryGetMessageFromQueue方法代码示例

本文整理汇总了C#中Rhino.ServiceBus.Msmq.OpenedQueue.TryGetMessageFromQueue方法的典型用法代码示例。如果您正苦于以下问题:C# OpenedQueue.TryGetMessageFromQueue方法的具体用法?C# OpenedQueue.TryGetMessageFromQueue怎么用?C# OpenedQueue.TryGetMessageFromQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rhino.ServiceBus.Msmq.OpenedQueue的用法示例。


在下文中一共展示了OpenedQueue.TryGetMessageFromQueue方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePeekedMessage

		protected override void HandlePeekedMessage(OpenedQueue queue, Message message)
		{
			try
			{
				using (var tx = new TransactionScope(TransactionScopeOption.Required, TransportUtil.GetTransactionTimeout()))
				{
					message = queue.TryGetMessageFromQueue(message.Id);
					if (message == null)
						return;

					if ((MessageType) message.AppSpecific == MessageType.LoadBalancerMessageMarker)
					{
						HandleLoadBalancerMessage(queue, message);
					}
				tx.Complete();
				}
			}
			catch (Exception e)
			{
				logger.Error("Fail to process load balanced message properly", e);
			}
		}
开发者ID:JackWangCUMT,项目名称:rhino-esb,代码行数:22,代码来源:MsmqReadyForWorkListener.cs

示例2: HandlePeekedMessage

		protected override void HandlePeekedMessage(OpenedQueue queue, Message message)
		{
			try
			{
				using (var tx = new TransactionScope(TransactionScopeOption.Required, TransportUtil.GetTransactionTimeout()))
				{
					message = queue.TryGetMessageFromQueue(message.Id);
					if (message == null)
						return;

					PersistEndpoint(queue, message);

					switch ((MessageType)message.AppSpecific)
					{
						case MessageType.ShutDownMessageMarker:
							//silently cnsume the message
							break;
						case MessageType.LoadBalancerMessageMarker:
							HandleLoadBalancerMessage(queue, message);
							break;
						case MessageType.AdministrativeMessageMarker:
							SendToAllWorkers(message, "Dispatching administrative message from {0} to load balancer {1}");
							break;
						default:
							HandleStandardMessage(queue, message);
							break;
					}
					tx.Complete();
				}
			}
			catch (Exception e)
			{
				logger.Error("Fail to process load balanced message properly", e);
			}
		}
开发者ID:BiYiTuan,项目名称:rhino-esb,代码行数:35,代码来源:MsmqLoadBalancer.cs

示例3: ReceiveMessageInTransaction

        public void ReceiveMessageInTransaction(OpenedQueue queue, string messageId, Func<CurrentMessageInformation, bool> messageArrived, Action<CurrentMessageInformation, Exception> messageProcessingCompleted)
        {
            var transactionOptions = new TransactionOptions
            {
                IsolationLevel = queueIsolationLevel,
                Timeout = TransportUtil.GetTransactionTimeout(),
            };
            using (var tx = new TransactionScope(TransactionScopeOption.Required, transactionOptions))
            {
                var message = queue.TryGetMessageFromQueue(messageId);

                if (message == null)
                    return;// someone else got our message, better luck next time

                ProcessMessage(message, queue, tx, messageArrived, messageProcessingCompleted);
            }
        }
开发者ID:ajzaslow,项目名称:rhino-esb,代码行数:17,代码来源:MsmqTransport.cs

示例4: ReceiveMessage

        private void ReceiveMessage(OpenedQueue queue, string messageId, Func<CurrentMessageInformation, bool> messageArrived, Action<CurrentMessageInformation, Exception> messageProcessingCompleted)
        {
            var message = queue.TryGetMessageFromQueue(messageId);

            if (message == null)
                return;

            ProcessMessage(message, queue, null, messageArrived, null, null, messageProcessingCompleted);
        }
开发者ID:robink-teleopti,项目名称:rhino-esb,代码行数:9,代码来源:MsmqTransport.cs


注:本文中的Rhino.ServiceBus.Msmq.OpenedQueue.TryGetMessageFromQueue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。