示例#1
0
        public PointToPointChannelInfo GetPointToPointChannel(string connectionstring, string path)
        {
            var namespaceManager = GetNamespaceManager(connectionstring);

            if (namespaceManager != null)
            {
                try
                {
                    var entity = namespaceManager.GetQueue(path);

                    var info = new PointToPointChannelInfo(path)
                    {
                        DeadLetterMessageCount = entity.MessageCountDetails.DeadLetterMessageCount,
                        MessageCount           = entity.MessageCountDetails.ActiveMessageCount,
                        ScheduledMessageCount  = entity.MessageCountDetails.ScheduledMessageCount,
                        SizeInBytes            = entity.SizeInBytes
                    };

                    return(info);
                }
                catch (Exception)
                {
                    return(null);
                }
            }

            return(null);
        }
        public PointToPointChannelInfo GetPointToPointChannel(string connectionstring, string path)
        {
            var configuration = JsonConvert.DeserializeObject <ServiceBusConfiguration>(connectionstring);

            var serviceBusNamespace = GetServiceBusNamespace(configuration);

            if (serviceBusNamespace != null)
            {
                try
                {
                    var queue = serviceBusNamespace.Queues.GetByName(path);

                    var info = new PointToPointChannelInfo(path)
                    {
                        DeadLetterMessageCount = queue.DeadLetterMessageCount,
                        MessageCount           = queue.ActiveMessageCount,
                        ScheduledMessageCount  = queue.ScheduledMessageCount,
                        SizeInBytes            = queue.CurrentSizeInBytes
                    };

                    return(info);
                }
                catch (Exception)
                {
                    return(null);
                }
            }

            return(null);
        }