Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D88C6200CD1 for ; Wed, 26 Jul 2017 18:01:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D7381168E44; Wed, 26 Jul 2017 16:01:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 27EF7168E41 for ; Wed, 26 Jul 2017 18:01:22 +0200 (CEST) Received: (qmail 73836 invoked by uid 500); 26 Jul 2017 16:01:16 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 73825 invoked by uid 99); 26 Jul 2017 16:01:15 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jul 2017 16:01:15 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 619BE1A099B for ; Wed, 26 Jul 2017 16:01:15 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.487 X-Spam-Level: *** X-Spam-Status: No, score=3.487 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URI_HEX=1.313, URI_TRY_3LD=0.001] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ZKaMN8VqCJqW for ; Wed, 26 Jul 2017 16:01:14 +0000 (UTC) Received: from mwork.nabble.com (mwork.nabble.com [162.253.133.43]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 01DAD61B43 for ; Wed, 26 Jul 2017 16:01:11 +0000 (UTC) Received: from mjoe.nabble.com (unknown [162.253.133.57]) by mwork.nabble.com (Postfix) with ESMTP id B3E55565B1E63 for ; Wed, 26 Jul 2017 09:01:11 -0700 (MST) Date: Wed, 26 Jul 2017 09:01:11 -0700 (PDT) From: zaeem To: users@activemq.apache.org Message-ID: <1501084871370-4728936.post@n4.nabble.com> In-Reply-To: <1501084582655-4728935.post@n4.nabble.com> References: <1501076329830-4728927.post@n4.nabble.com> <6de607c8-df38-0693-e341-021bd1b1357d@gmail.com> <1501084582655-4728935.post@n4.nabble.com> Subject: Re: How to find consumers on an exiting ActiveMQ Queue in c# MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit archived-at: Wed, 26 Jul 2017 16:01:23 -0000 Below snippets lets you list Queues on the broker,Topics but i need something similar to list consumers on Queues for that broker by just passing a Queue Name. public const string QUEUE_ADVISORY_DESTINATION = "ActiveMQ.Advisory.Queue"; public const string TOPIC_ADVISORY_DESTINATION = "ActiveMQ.Advisory.Topic"; public const string TEMPQUEUE_ADVISORY_DESTINATION = "ActiveMQ.Advisory.TempQueue"; public const string TEMPTOPIC_ADVISORY_DESTINATION = "ActiveMQ.Advisory.TempTopic"; private static void Enumerate(string destination, Action action) { IDestination dest = _session.GetTopic(destination); using (IMessageConsumer consumer = _session.CreateConsumer(dest)) { IMessage advisory; while ((advisory = consumer.Receive(TimeSpan.FromMinutes(2000))) != null) { ActiveMQMessage am = advisory as ActiveMQMessage; if (am != null & am.DataStructure != null) { DestinationInfo info = am.DataStructure as DestinationInfo; if (info != null) { action(info); } } } } } public static void EnumerateQueues() { Console.WriteLine("Listing all Queues on Broker:"); Enumerate(QUEUE_ADVISORY_DESTINATION, info => Console.WriteLine(" Queue: " + info.Destination)); Console.WriteLine("Listing Complete."); } public static void EnumerateTopics() { Console.WriteLine("Listing all Topics on Broker:"); Enumerate(TOPIC_ADVISORY_DESTINATION, info => Console.WriteLine(" Topic: " + info.Destination)); Console.WriteLine("Listing Complete."); } public static void EnumerateDestinations() { Console.WriteLine("Listing all Destinations on Broker:"); Enumerate(ALLDEST_ADVISORY_DESTINATION, info => { string destType = info.Destination.IsTopic ? "Topic" : "Qeue"; destType = info.Destination.IsTemporary ? "Temporary" + destType : destType; Console.WriteLine(" " + destType + ": " + info.Destination); }); Console.WriteLine("Listing Complete."); } -- View this message in context: http://activemq.2283324.n4.nabble.com/How-to-find-consumers-on-an-existing-ActiveMQ-Queue-in-c-tp4728927p4728936.html Sent from the ActiveMQ - User mailing list archive at Nabble.com.