From users-return-23462-apmail-activemq-users-archive=activemq.apache.org@activemq.apache.org Fri Apr 30 07:29:15 2010 Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 3383 invoked from network); 30 Apr 2010 07:29:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 30 Apr 2010 07:29:15 -0000 Received: (qmail 73214 invoked by uid 500); 30 Apr 2010 07:02:33 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 73190 invoked by uid 500); 30 Apr 2010 07:02:33 -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 73175 invoked by uid 99); 30 Apr 2010 07:02:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Apr 2010 07:02:33 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of chubrilo@gmail.com designates 72.14.220.159 as permitted sender) Received: from [72.14.220.159] (HELO fg-out-1718.google.com) (72.14.220.159) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 30 Apr 2010 07:02:26 +0000 Received: by fg-out-1718.google.com with SMTP id l26so3815538fgb.14 for ; Fri, 30 Apr 2010 00:02:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=iMNRaMG0UoZ/fyDcOzaphodNuSM6uLomRiyiSqGa278=; b=IH6kL/PL0WCHthWit6KZepdvjlVu2bomYkUcMeoNO8BsP7frI3aoDyAY4g5jm0+oOE CufxNfR22L0gQxnMr89KzohTxpC3sFFsl0l9FNszC1fJBU8GNlBnReyEYb4E5qHQSkVL NkksT93DzcxuhCGkT0qSirJGdV+pkgR5aeqGE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type; b=XC9iRczKYFLzBBmbO0f2Z0VV93iHJl+dNXHaAp/QI1jx5t0n4FrW3huQLw+Ju+0xz+ REZGl3PBr9Z2CVyKTxqbkG9uUtrzEwR0ry9yYwtdmL/2PvP81FhKO68taSFms6QilVlL KH608jY6DyhC13eHXN8CO7Xt2sHiiFzir2kto= MIME-Version: 1.0 Received: by 10.239.185.84 with SMTP id b20mr942386hbh.37.1272610926198; Fri, 30 Apr 2010 00:02:06 -0700 (PDT) Sender: chubrilo@gmail.com Received: by 10.239.153.205 with HTTP; Fri, 30 Apr 2010 00:02:06 -0700 (PDT) In-Reply-To: <28409087.post@talk.nabble.com> References: <28409087.post@talk.nabble.com> Date: Fri, 30 Apr 2010 09:02:06 +0200 X-Google-Sender-Auth: 2b1f76f1c701f74b Message-ID: Subject: Re: AdvisoryConsumer From: Dejan Bosanac To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=001485f7791a31806104856ed20a X-Virus-Checked: Checked by ClamAV on apache.org --001485f7791a31806104856ed20a Content-Type: text/plain; charset=ISO-8859-1 Hi, you can save that info in your application and map consumerid with other info from ConsumerInfo when it is connected. Cheers -- Dejan Bosanac - http://twitter.com/dejanb Open Source Integration - http://fusesource.com/ ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net On Fri, Apr 30, 2010 at 8:57 AM, Kalpana Jalawadi < kalpana.jalawadi@gmail.com> wrote: > > Hi, > > I'm using AdvisoryConsumer in my MessageProducer to listen to the consumers > activities. On a consumer shutdown, I would want to perform some cleanup > job. Below is the code: > > Topic advisoryTopic = AdvisorySupport > .getConsumerAdvisoryTopic((ActiveMQDestination) > JMSConnection.getInstance().getTopic()); > MessageConsumer advisoryConsumer = > JMSConnection.getInstance().getSession().createConsumer(advisoryTopic); > advisoryConsumer.setMessageListener(new MessageListener() { > public void onMessage(Message message) { > if (message instanceof ActiveMQMessage) { > ActiveMQMessage aMsg = (ActiveMQMessage) message; > > DataStructure dataStructure = aMsg.getDataStructure(); > if (dataStructure instanceof ConsumerInfo) { > System.out.println("Consumer started, ConsumerInfo > :" + message.toString()); > ... > } else if (dataStructure instanceof RemoveInfo) { > RemoveInfo removeInfo = (RemoveInfo) dataStructure; > DataStructure objectId = removeInfo.getObjectId(); > System.out.println("Consumer stopped, ConsumerInfo > :" + message.toString()); > // do some clean up > } > } > } > }); > > RemoveInfo command, exposes the consumerId (some magic string consisting of > connection id, session id and some long value), is there a way to find the > subscription name that is specified while creating the consumer using the > consumer id that is available to me? Or any other work around where I could > clearly identify who is the consumer who is dead? > Any help w.r.t this would be highly appreciated. > > Thanks! > -- > View this message in context: > http://old.nabble.com/AdvisoryConsumer-tp28409087p28409087.html > Sent from the ActiveMQ - User mailing list archive at Nabble.com. > > --001485f7791a31806104856ed20a--