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


C# Message.GetMessageId方法代码示例

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


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

示例1: HandlePeekedMessage

        public bool HandlePeekedMessage(IMsmqTransport transport, OpenedQueue queue, Message message)
        {
            bool doesNotHaveMessageId = message.Extension.Length < 16;
            if(doesNotHaveMessageId)
            {
                const string errorMessage = "Message does not have Extension set to at least 16 bytes, which will be used as the message id. Probably not a bus message.";
                transport.RaiseMessageSerializationException(queue,message,errorMessage);
                MoveToErrorQueue(queue, message, errorMessage);
                return true;
            }

            var id = message.GetMessageId();
            ErrorCounter errorCounter = null;

            failureCounts.Read(reader => reader.TryGetValue(id, out errorCounter));

            if (errorCounter == null)
                return false;

            if (errorCounter.FailureCount < numberOfRetries)
                return false;

            failureCounts.Write(writer =>
            {
                writer.Remove(id);
                MoveToErrorQueue(queue, message, errorCounter.ExceptionText);
            });

            return true;
        }
开发者ID:eyantiful,项目名称:rhino-esb,代码行数:30,代码来源:ErrorAction.cs

示例2: DeserializeMessages

        protected object[] DeserializeMessages(OpenedQueue messageQueue, Message transportMessage, Action<CurrentMessageInformation, Exception> messageSerializationException)
        {
            try
            {
                return messageSerializer.Deserialize(transportMessage.BodyStream);
            }
            catch (Exception e)
            {
                try
                {
                    logger.Error("Error when serializing message", e);
                    if (messageSerializationException != null)
                    {
                        var information = new MsmqCurrentMessageInformation
                        {
                            MsmqMessage = transportMessage,
                            Queue = messageQueue,
                            Message = transportMessage,
                            Source = messageQueue.RootUri,
                            MessageId = transportMessage.GetMessageId(),
                            Headers = transportMessage.Extension.DeserializeHeaders(),
                        };

                        messageSerializationException(information, e);
                    }
                }
                catch (Exception moduleEx)
                {
                    logger.Error("Error when notifying about serialization exception", moduleEx);
                }
                throw;
            }
        }
开发者ID:helge,项目名称:rhino-esb,代码行数:33,代码来源:AbstractMsmqListener.cs

示例3: CreateMessageInformation

 private MsmqCurrentMessageInformation CreateMessageInformation(OpenedQueue queue,Message message, object[] messages, object msg)
 {
     return new MsmqCurrentMessageInformation
     {
         MessageId = message.GetMessageId(),
         AllMessages = messages,
         Message = msg,
         Queue = queue,
         TransportMessageId = message.Id,
         Destination = Endpoint.Uri,
         Source = MsmqUtil.GetQueueUri(message.ResponseQueue),
         MsmqMessage = message,
         TransactionType = queue.GetTransactionType()
     };
 }
开发者ID:ajzaslow,项目名称:rhino-esb,代码行数:15,代码来源:MsmqTransport.cs


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