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


C# IMessage.Acknowledge方法代码示例

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


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

示例1: OnMessage

        public void OnMessage(IMessage message)
        {
            object data = CreateDataObject(message);
            bool isPermKeyOk = false;

            //Israel 11/20/2015 -- Added support for permission keys.
            if (message.NMSType.ToUpper() == "SUMMARY")
            {
                SummaryData summaryData = data as SummaryData;
                isPermKeyOk = (String.IsNullOrEmpty(summaryData.PermissionKey)) || 
                              (v_PermKeyList.IndexOf(summaryData.PermissionKey) > -1);
                if (isPermKeyOk || v_IsSuperUser)
                    callback.Invoke(this, data);
            }
            //Israel 12/16/2015 -- Message publisher was escaping the : character-- this removes it.
            else if (message.NMSType.ToUpper() == "CONFIRM")
            {
                TradeRqmtConfirm confirmData = data as TradeRqmtConfirm;
                if (!String.IsNullOrEmpty(confirmData.XmitAddr))
                confirmData.XmitAddr = confirmData.XmitAddr.Replace(@"\", "");
                callback.Invoke(this, data);
            }
            else
            {
                callback.Invoke(this, data);
            }

            message.Acknowledge();
            //string testMessage = DateTime.Now.ToShortDateString() + ":" + DateTime.Now.ToLongTimeString() + ": " + message.ToString();
            //File.AppendAllText(@"_MessageDump.txt", testMessage + Environment.NewLine);
        }
开发者ID:Amphora2015,项目名称:DemoTest,代码行数:31,代码来源:CallbackHandler.cs

示例2: OnMessageListener

 private void OnMessageListener(IMessage message)
 {        
     counter++;
     if(this.counter <= 4) 
     {
         session.Rollback();
     }
     else
     {
         message.Acknowledge();
         session.Commit();
     }
 }
开发者ID:Redi0,项目名称:meijing-ui,代码行数:13,代码来源:MessageListenerRedeliveryTest.cs

示例3: OnMessage

        public void OnMessage(IMessage message)
        {
            Assert.IsNotNull(message);

            if(!dontAck)
            {
                try
                {
                    message.Acknowledge();
                }
                catch(Exception)
                {
                }
            }
        }
开发者ID:ThorTech,项目名称:apache-nms,代码行数:15,代码来源:ConsumerTest.cs

示例4: OnMessage

        /// <summary>
        /// Receives all of the test messages.
        /// </summary>
        ///
        /// <param name="message">The newly arrived test message.</param>
        public void OnMessage(IMessage message)
        {
            try
            {
                if (_acknowledgeMode == AcknowledgeMode.ClientAcknowledge)
                {
                    message.Acknowledge();
                }

                messagesReceived++;

                _log.Debug("messagesReceived = " + messagesReceived);

                // Check if all of the messages in the test have been received, in which case notify the message producer that the test has 
                // succesfully completed.
                if (messagesReceived == NUM_MESSAGES + _extraMessage)
                {
                    lock (testComplete)
                    {
			failedOver = true;
                        Monitor.Pulse(testComplete);
                    }
                }
            }
            catch (QpidException e)
            {
                _log.Fatal("Exception received. About to stop.", e);
                Stop();
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:35,代码来源:FailoverTest.cs

示例5: OnInvalidate

        protected void OnInvalidate(IMessage receivedMsg)
        {
           
            IObjectMessage m2 = receivedMsg as IObjectMessage;
            Debug.WriteLine("message has the following raw content:");
           // Debug.WriteLine(m2.)
            try
            {
                object obj = m2.Body;
            }
            catch (Exception e)
            {
                Debug.WriteLine("caught exception while accessing message body: " + e.Message);
            }
            object obj2 = m2.ToObject();

            var msg = receivedMsg as IBytesMessage;
            var result = msg != null ? new UTF8Encoding().GetString(msg.Content) : "bytes message is null";

            ITextMessage message = receivedMsg as ITextMessage;
            if (message == null)
            {
                Logger.Debug(string.Format("message with id {0} is not a text message", receivedMsg.NMSMessageId));
                Debug.WriteLine(string.Format("message with id {0} is not a text message", receivedMsg.NMSMessageId));
                receivedMsg.Acknowledge();
                return;
            }

            Logger.Debug(string.Format("received text message with id {0} and text {1}", message.NMSMessageId, message.Text));
            Debug.WriteLine(string.Format("received text message with id {0} and text {1}", message.NMSMessageId, message.Text));

            try
            {
                var invalidationInformation = GetInvalidationInformation(message);
                foreach (string dcpUri in invalidationInformation.InvalidationDcps) 
                {
                    foreach (ICacheAgent cacheAgent in CacheAgents)
                    {
                        Logger.Debug(string.Format("telling cache agent {0} to remove DCP with uri {1}", cacheAgent.GetType().Name, dcpUri));
                        //cacheAgent.Remove(dcpUri)
                    }
                }
                foreach (InvalidationUrl url in invalidationInformation.InvalidationUrls)
                {
                    foreach (ICacheAgent cacheAgent in CacheAgents)
                    {
                        Logger.Debug(string.Format("telling cache agent {0} to remove page with url {1}", cacheAgent.GetType().Name, url.TcmUri));
                        //cacheAgent.Remove(url.TcmUri)
                    }
                }

                //LoggerService.Debug("<<Received message: finished processing");
            }
            catch (Exception e)
            {
                Logger.Error("error in invalidation transaction: {0}", e.ToString());
            }
            finally
            {
                message.Acknowledge();
                Logger.Debug(string.Format("acknowledged received message with id {0}", message.NMSMessageId));
            }
        }
开发者ID:contacttomukesh,项目名称:DD4T.Core,代码行数:63,代码来源:JMSListener.cs

示例6: MessageAccepted

 public void MessageAccepted(IMessage message)
 {
     message.Acknowledge();
 }
开发者ID:modulexcite,项目名称:NServiceBus.ActiveMQ,代码行数:4,代码来源:NoTransactionScope.cs

示例7: CommitIfNecessary

 /// <summary>
 /// Perform a commit or message acknowledgement, as appropriate
 /// </summary>
 /// <param name="session">The session to commit.</param>
 /// <param name="message">The message to acknowledge.</param>
 /// <exception cref="NMSException">In case of commit failure</exception>
 protected virtual void CommitIfNecessary(ISession session, IMessage message)
 {
     // Commit session or acknowledge message
     if (session.Transacted)
     {
         // Commit necessary - but avoid commit call is Session transaction is externally coordinated.
         if (IsSessionLocallyTransacted(session))
         {
             NmsUtils.CommitIfNecessary(session);
         }
     }
     else if (IsClientAcknowledge(session))
     {
         message.Acknowledge();
     }
 }
开发者ID:Binodesk,项目名称:spring-net,代码行数:22,代码来源:AbstractMessageListenerContainer.cs

示例8: MessageListenerB

		private void MessageListenerB(IMessage message)
		{
			message.Acknowledge();
			ITextMessage messageB = message as ITextMessage;
			string msgText = "Message #" + receivedB;
			Assert.AreEqual(msgText, messageB.Text, "Message text B does not match.");
			Tracer.Info("Received Listener B: " + msgText);
			receivedB++;
		}
开发者ID:Redi0,项目名称:meijing-ui,代码行数:9,代码来源:VirtualTopicTest.cs


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