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


C# ISession.CreateTemporaryQueue方法代码示例

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


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

示例1: ClientResultStream

        public ClientResultStream(OpenGammaFudgeContext fudgeContext, MQTemplate mqTemplate, bool checkSeqNumber)
        {
            _mqTemplate = mqTemplate;

            _fudgeMessageDecoder = new FudgeMessageDecoder(fudgeContext, checkSeqNumber);
            _connection = _mqTemplate.CreateConnection();
            _session = _connection.CreateSession();

            _destination = _session.CreateTemporaryQueue();

            _consumer = _session.CreateConsumer(_destination);
            _consumer.Listener += RawMessageReceived;
            _connection.Start();
        }
开发者ID:BietteMaxime,项目名称:OG-DotNet,代码行数:14,代码来源:ClientResultStream.cs

示例2: TestQueueRollbackConsumerListener

        public void TestQueueRollbackConsumerListener()
        {
            connection.Start();

            this.session = connection.CreateSession(AcknowledgementMode.Transactional);
            ITemporaryQueue queue = session.CreateTemporaryQueue();
            IMessageProducer producer = session.CreateProducer(queue);
            IMessage message = session.CreateTextMessage("Test Message");
            producer.Send(message);
            session.Commit();

            IMessageConsumer consumer = session.CreateConsumer(queue);

            consumer.Listener += new MessageListener(OnMessageListener);

            Thread.Sleep(500);

            // first try.. should get 2 since there is no delay on the
            // first redeliver..
            Assert.AreEqual(2, counter);

            Thread.Sleep(1000);

            // 2nd redeliver (redelivery after 1 sec)
            Assert.AreEqual(3, counter);

            Thread.Sleep(2000);

            // 3rd redeliver (redelivery after 2 seconds) - it should give up after
            // that
            Assert.AreEqual(4, counter);

            // create new message
            producer.Send(session.CreateTextMessage("Test Message Again"));
            session.Commit();

            Thread.Sleep(500);

            // it should be committed, so no redelivery
            Assert.AreEqual(5, counter);

            Thread.Sleep(1500);

            // no redelivery, counter should still be 5
            Assert.AreEqual(5, counter);

            session.Close();
        }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:48,代码来源:MessageListenerRedeliveryTest.cs

示例3: GetReplyDestination

 private IDestination GetReplyDestination(ISession session)
 {
     if (replyDestination != null)
     {
         return replyDestination;
     }
     if (replyDestinationName != null)
     {
         AssertUtils.ArgumentNotNull(this.destinationResolver,
                                     "DestinationResolver is required when relying upon the 'replyDestinationName' property.");
         return destinationResolver.ResolveDestinationName(
             session, replyDestinationName, pubSubDomain);
     }
     return session.CreateTemporaryQueue();
 }
开发者ID:rlxrlxrlx,项目名称:spring-net-integration,代码行数:15,代码来源:NmsOutboundGateway.cs

示例4: CreateDestination

        public IDestination CreateDestination(ISession session, DestinationType type, string name)
        {
            if(name == "")
            {
                name = "TEST." + this.GetType().Name + "." + Guid.NewGuid();
            }

            switch(type)
            {
            case DestinationType.Queue:
                return session.GetQueue(name);
            case DestinationType.Topic:
                return session.GetTopic(name);
            case DestinationType.TemporaryQueue:
                return session.CreateTemporaryQueue();
            case DestinationType.TemporaryTopic:
                return session.CreateTemporaryTopic();
            default:
                throw new ArgumentException("type: " + type);
            }
        }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:21,代码来源:NMSTestSupport.cs

示例5: GetDestination

		/// <summary>
		/// Get the destination by parsing the embedded type prefix.
		/// </summary>
		/// <param name="session">Session object to use to get the destination.</param>
		/// <param name="destinationName">Name of destination with embedded prefix.  The embedded prefix can be one of the following:
		///		<list type="bullet">
		///			<item>queue://</item>
		///			<item>topic://</item>
		///			<item>temp-queue://</item>
		///			<item>temp-topic://</item>
		///		</list>
		///	</param>
		/// <param name="defaultType">Default type if no embedded prefix is specified.</param>
		/// <returns></returns>
		public static IDestination GetDestination(ISession session, string destinationName, DestinationType defaultType)
		{
			IDestination destination = null;
			DestinationType destinationType = defaultType;

			if(null != destinationName)
			{
				if(destinationName.Length > QueuePrefix.Length
					&& 0 == String.Compare(destinationName.Substring(0, QueuePrefix.Length), QueuePrefix, false))
				{
					destinationType = DestinationType.Queue;
					destinationName = destinationName.Substring(QueuePrefix.Length);
				}
				else if(destinationName.Length > TopicPrefix.Length
					&& 0 == String.Compare(destinationName.Substring(0, TopicPrefix.Length), TopicPrefix, false))
				{
					destinationType = DestinationType.Topic;
					destinationName = destinationName.Substring(TopicPrefix.Length);
				}
				else if(destinationName.Length > TempQueuePrefix.Length
					&& 0 == String.Compare(destinationName.Substring(0, TempQueuePrefix.Length), TempQueuePrefix, false))
				{
					destinationType = DestinationType.TemporaryQueue;
					destinationName = destinationName.Substring(TempQueuePrefix.Length);
				}
				else if(destinationName.Length > TempTopicPrefix.Length
					&& 0 == String.Compare(destinationName.Substring(0, TempTopicPrefix.Length), TempTopicPrefix, false))
				{
					destinationType = DestinationType.TemporaryTopic;
					destinationName = destinationName.Substring(TempTopicPrefix.Length);
				}
			}

			switch(destinationType)
			{
			case DestinationType.Queue:
				if(null != destinationName)
				{
					destination = session.GetQueue(destinationName);
				}
			break;

			case DestinationType.Topic:
				if(null != destinationName)
				{
					destination = session.GetTopic(destinationName);
				}
			break;

			case DestinationType.TemporaryQueue:
				destination = session.CreateTemporaryQueue();
			break;

			case DestinationType.TemporaryTopic:
				destination = session.CreateTemporaryTopic();
			break;
			}

			return destination;
		}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:74,代码来源:SessionUtils.cs


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