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 E5A38200CD1 for ; Wed, 26 Jul 2017 18:05:46 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id E43E81690DF; Wed, 26 Jul 2017 16:05:46 +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 0F9D71690DC for ; Wed, 26 Jul 2017 18:05:45 +0200 (CEST) Received: (qmail 81431 invoked by uid 500); 26 Jul 2017 16:05:45 -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 81419 invoked by uid 99); 26 Jul 2017 16:05:44 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Jul 2017 16:05:44 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 3D9331806A9 for ; Wed, 26 Jul 2017 16:05:44 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.943 X-Spam-Level: ** X-Spam-Status: No, score=2.943 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, KAM_LIVE=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RCVD_IN_SORBS_SPAM=0.5, SPF_PASS=-0.001, URI_HEX=1.313, URI_TRY_3LD=0.001] autolearn=disabled Authentication-Results: spamd3-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id B_MLcTay13Vq for ; Wed, 26 Jul 2017 16:05:43 +0000 (UTC) Received: from mail-qt0-f171.google.com (mail-qt0-f171.google.com [209.85.216.171]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 0D8455F6D2 for ; Wed, 26 Jul 2017 16:05:43 +0000 (UTC) Received: by mail-qt0-f171.google.com with SMTP id s6so58567935qtc.1 for ; Wed, 26 Jul 2017 09:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=0kT7vfRkLuxKgi9HCxwX4/NTatMEEwfbzsJrUc3N/E4=; b=skRVtuEUcCxpUTSm5MZjv6PideaEWegH43w+zgnW75tqUzAi+u0f6LhEcUZMS86Uf6 hYjFXWffBZTdHCq7DnDTvvAKas47WsASsDtncDJQ4R9Pnr+w+wKzr/6HXlBJu8YGHhVt BCsFMC77YgGeZNPu+MadwsFbEqC9ob4MH3AI3+4O3S8tpzjaJqL4krvv7zmffZDs2U62 hhBpu+83Ap63Z6/Xp3wLLK/7SbIWy+XSHw2EP8npM/jcAmmz7Qnyb6BFuXSJ7MoeSkYV RoFnN6uhaay/eRq1g0vMUJVcul+h40jPH8c4RUdp42k2/Ex+uow1k33l7S2g68Wed6xI mS7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=0kT7vfRkLuxKgi9HCxwX4/NTatMEEwfbzsJrUc3N/E4=; b=EdMMD82OyXTBSKeihS576lZwVB2VmiW4lHjZy6nsGKoy/Kt6YGuAUvcu/gvMe5qM+j m6lfyJtb0G0ARFiqZlLLo/WQxxmpe/1jWAGc4bF2ChiQXgesb2msT6XkFek28BQEw6b2 OGQT35Am/aScItIvXy+G3ieW7Z2Lt/iJkN9jvbonauSWSb8/LT2OPTA3RIgdhgEFPTgT b/EkCVXn3KEFODG5r5aE5xwFZLJtT2bun9BQmFvdpn6ZN/NorOxTUNzDFT7rNy5zCAb3 paXSX6kcLBvay2Zwelue7/OXYB9xelY3QSbcAN0jxONuyJPh3T4Q9hMuw48K0/S7O684 bWCw== X-Gm-Message-State: AIVw112U9bpxZ9INXXSQDKqp3zTSNbt6nNzUm83rSPVr8gu8GZOmS82I pXEk8o3MX1845RlJ X-Received: by 10.237.53.28 with SMTP id a28mr1949520qte.110.1501085142303; Wed, 26 Jul 2017 09:05:42 -0700 (PDT) Received: from [192.168.2.150] (c-73-135-242-162.hsd1.va.comcast.net. [73.135.242.162]) by smtp.googlemail.com with ESMTPSA id s32sm2507081qth.71.2017.07.26.09.05.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Jul 2017 09:05:39 -0700 (PDT) Subject: Re: How to find consumers on an exiting ActiveMQ Queue in c# To: users@activemq.apache.org References: <1501076329830-4728927.post@n4.nabble.com> <6de607c8-df38-0693-e341-021bd1b1357d@gmail.com> <1501084582655-4728935.post@n4.nabble.com> <1501084871370-4728936.post@n4.nabble.com> From: Timothy Bish Message-ID: Date: Wed, 26 Jul 2017 12:05:39 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <1501084871370-4728936.post@n4.nabble.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US archived-at: Wed, 26 Jul 2017 16:05:47 -0000 On 07/26/2017 12:01 PM, zaeem wrote: > 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. No such API exists outside JMX, you have to do the work using only advisories and statistics > > 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. > -- Tim Bish twitter: @tabish121 blog: http://timbish.blogspot.com/