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


C# IBasicProperties.IsReplyToPresent方法代码示例

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


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

示例1: CopyFrom

        public void CopyFrom(IBasicProperties basicProperties)
        {
            Preconditions.CheckNotNull(basicProperties, "basicProperties");

            if (basicProperties.IsContentTypePresent())         ContentType         = basicProperties.ContentType;
            if (basicProperties.IsContentEncodingPresent())     ContentEncoding     = basicProperties.ContentEncoding;
            if (basicProperties.IsDeliveryModePresent())        DeliveryMode        = basicProperties.DeliveryMode;
            if (basicProperties.IsPriorityPresent())            Priority            = basicProperties.Priority;
            if (basicProperties.IsCorrelationIdPresent())       CorrelationId       = basicProperties.CorrelationId;
            if (basicProperties.IsReplyToPresent())             ReplyTo             = basicProperties.ReplyTo;
            if (basicProperties.IsExpirationPresent())          Expiration          = basicProperties.Expiration;
            if (basicProperties.IsMessageIdPresent())           MessageId           = basicProperties.MessageId;
            if (basicProperties.IsTimestampPresent())           Timestamp           = basicProperties.Timestamp.UnixTime;
            if (basicProperties.IsTypePresent())                Type                = basicProperties.Type;
            if (basicProperties.IsUserIdPresent())              UserId              = basicProperties.UserId;
            if (basicProperties.IsAppIdPresent())               AppId               = basicProperties.AppId;
            if (basicProperties.IsClusterIdPresent())           ClusterId           = basicProperties.ClusterId;

            if (basicProperties.IsHeadersPresent())
            {
                foreach (var header in basicProperties.Headers)
                {
                    Headers.Add(header.Key, header.Value);
                }
            }
        }
开发者ID:fryderykhuang,项目名称:EasyNetQ,代码行数:26,代码来源:MessageProperties.cs

示例2: MessageBasicProperties

        public MessageBasicProperties(IBasicProperties basicProperties)
            : this()
        {
            ContentTypePresent = basicProperties.IsContentTypePresent();
            ContentEncodingPresent = basicProperties.IsContentEncodingPresent();
            HeadersPresent = basicProperties.IsHeadersPresent();
            DeliveryModePresent = basicProperties.IsDeliveryModePresent();
            PriorityPresent = basicProperties.IsPriorityPresent();
            CorrelationIdPresent = basicProperties.IsCorrelationIdPresent();
            ReplyToPresent = basicProperties.IsReplyToPresent();
            ExpirationPresent = basicProperties.IsExpirationPresent();
            MessageIdPresent = basicProperties.IsMessageIdPresent();
            TimestampPresent = basicProperties.IsTimestampPresent();
            TypePresent = basicProperties.IsTypePresent();
            UserIdPresent = basicProperties.IsUserIdPresent();
            AppIdPresent = basicProperties.IsAppIdPresent();
            ClusterIdPresent = basicProperties.IsClusterIdPresent();

            ContentType = basicProperties.ContentType;
            ContentEncoding = basicProperties.ContentEncoding;
            DeliveryMode = basicProperties.DeliveryMode;
            Priority = basicProperties.Priority;
            CorrelationId = basicProperties.CorrelationId;
            ReplyTo = basicProperties.ReplyTo;
            Expiration = basicProperties.Expiration;
            MessageId = basicProperties.MessageId;
            Timestamp = basicProperties.Timestamp.UnixTime;
            Type = basicProperties.Type;
            UserId = basicProperties.UserId;
            AppId = basicProperties.AppId;
            ClusterId = basicProperties.ClusterId;

            if(basicProperties.IsHeadersPresent())
            {
                foreach (DictionaryEntry header in basicProperties.Headers)
                {
                    Headers.Add(header.Key, header.Value);
                }
            }
        }
开发者ID:redsquare,项目名称:EasyNetQ,代码行数:40,代码来源:MessageBasicProperties.cs

示例3: ConsumeMessage

        protected virtual async Task<bool> ConsumeMessage(bool redelivered, ulong deliveryTag, IBasicProperties properties, byte[] body)
        {
            DataContractKey dataContractKey = properties.GetDataContractKey();

            var subscription =
                _subscriptions.Where(p => p.Value.FilterInfo.ContractKey.Equals(dataContractKey)).Select(
                    pair =>
                        new
                        {
                            DataType = pair.Key,
                            pair.Value.Handler
                        }).FirstOrDefault();

            if (subscription == null)
            {
                 RawBusMessage rawBusMessage = _messageHelper.ConstructMessage(dataContractKey, properties, (object)body);

                _errorSubscriber.UnregisteredMessageArrived(rawBusMessage);

                return false;
            }

            object data;

            if (!_serializers.ContainsKey(properties.ContentType))
            {
                RawBusMessage rawBusMessage = _messageHelper.ConstructMessage(dataContractKey, properties, (object)body);

                _errorSubscriber.MessageDeserializeException(rawBusMessage, new Exception("Unsupported content type"));

                return false;
            }

            ISerializer serializer;
            
            try
            {
                serializer = _serializers[properties.ContentType];
                
                data = serializer.Deserialize(dataContractKey, subscription.DataType, body);
            }
            catch (Exception ex)
            {
                RawBusMessage rawBusMessage = _messageHelper.ConstructMessage(dataContractKey, properties, (object)body);

                _errorSubscriber.MessageDeserializeException(rawBusMessage, ex);

                return false;
            }
            
            RawBusMessage message = _messageHelper.ConstructMessage(dataContractKey, properties, data);

            if (!_receiveSelfPublish && _busId.Equals(message.BusId))
            {
                _errorSubscriber.MessageFilteredOut(message);

                return false;
            }

            _trace.MessageArrived(_busId, message, ConsumerTag);

            RawBusMessage reply;

            try
            {
                reply = await HandleMessage(subscription.Handler, message, redelivered, deliveryTag);
            }
            catch (RejectMessageException ex)
            {
                reply = new RawBusMessage
                {
                    Data = ex.ReplyData
                };
                
                reply.Headers.Add(new RejectedHeader());
            }
            catch (Exception ex)
            {
                _errorSubscriber.MessageDispatchException(message, ex);

                reply = new RawBusMessage();

                reply.Headers.Add(new ExceptionHeader
                {
                    Message = ex.Message
                });
            }

            if (!_neverReply && reply != null && properties.IsReplyToPresent())
            {
                _sendHelper.Send(new SendParams
                {
                    BusId = _busId,
                    BusMessage = reply,
                    Model = Model,
                    CorrelationId = properties.IsCorrelationIdPresent() ? properties.CorrelationId : "",
                    Exchange = _replyExchange,
                    RoutingKey = properties.ReplyTo,
                    Serializer = serializer,
                    MandatoryDelivery = false,
//.........这里部分代码省略.........
开发者ID:parshim,项目名称:MessageBus,代码行数:101,代码来源:MessageConsumer.cs

示例4: CopyFrom

        internal void CopyFrom(IBasicProperties from)
        {
            if (from == null)
                throw new ArgumentNullException(nameof(from));

            if (from.IsAppIdPresent()) AppId = from.AppId;
            if (from.IsClusterIdPresent()) ClusterId = from.ClusterId;
            if (from.IsContentEncodingPresent()) ContentEncoding = from.ContentEncoding;
            if (from.IsContentTypePresent()) ContentType = from.ContentType;
            if (from.IsCorrelationIdPresent()) CorrelationId = from.CorrelationId;
            if (from.IsDeliveryModePresent()) DeliveryMode = (LinkMessageDeliveryMode) from.DeliveryMode;
            if (from.IsReplyToPresent()) ReplyTo = from.ReplyTo;
            if (from.IsExpirationPresent()) Expiration = TimeSpan.FromMilliseconds(int.Parse(from.Expiration));
            if (from.IsMessageIdPresent()) MessageId = from.MessageId;
            if (from.IsTimestampPresent()) TimeStamp = from.Timestamp.UnixTime;
            if (from.IsTypePresent()) Type = from.Type;
            if (from.IsUserIdPresent()) UserId = from.UserId;
            if (from.IsPriorityPresent()) Priority = from.Priority;

            if (from.IsHeadersPresent())
            {
                foreach (var header in from.Headers)
                {
                    Headers[header.Key] = header.Value;
                }
            }
        }
开发者ID:rabbit-link,项目名称:rabbit-link,代码行数:27,代码来源:LinkMessageProperties.cs


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