Return-Path: X-Original-To: apmail-activemq-users-archive@www.apache.org Delivered-To: apmail-activemq-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C6B2DD763 for ; Thu, 1 Nov 2012 18:28:25 +0000 (UTC) Received: (qmail 2416 invoked by uid 500); 1 Nov 2012 18:28:25 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 2387 invoked by uid 500); 1 Nov 2012 18:28:25 -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 2377 invoked by uid 99); 1 Nov 2012 18:28:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2012 18:28:25 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of fulko.hew@gmail.com designates 209.85.217.171 as permitted sender) Received: from [209.85.217.171] (HELO mail-lb0-f171.google.com) (209.85.217.171) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 01 Nov 2012 18:28:17 +0000 Received: by mail-lb0-f171.google.com with SMTP id m4so2156527lbo.2 for ; Thu, 01 Nov 2012 11:27:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=6N9c5B6QUF4+Sz3EzEfzP8VFHUR2/9jkkC1dPp87Mgk=; b=MmhZq+MzpIhC8UdDya/XPLYqt2MprQMx9boOhnGG6ttuX4i/HRBU+k7qzO1uKeaAwk xJqUFt3yn5+7iRUcaqHTrYEwykNnZcz/V4I2jCCQBhD1vNVehSsUnT/J+d2vbe2g1GMp or+8QOW8L/sRMzau6tbv5UbUVw93XDNZDJnk9289wjU/cuarTmq1Ix0BHaRJw4w4o78K y0nUft7p8TYzHwmfDuSIbX9qYS0x4ytjZra0ktctgaf/h5WNQVQnnph/eEnWREXZ1m17 ViKjm/ozv1MLcuHpiAeZyvTeLZzrxEQYzYTGLzjsUmvS+nCnTv5I+4plyT0j4pFuDktb TShA== Received: by 10.112.51.175 with SMTP id l15mr6153476lbo.120.1351794476616; Thu, 01 Nov 2012 11:27:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.112.74.161 with HTTP; Thu, 1 Nov 2012 11:27:35 -0700 (PDT) From: Fulko Hew Date: Thu, 1 Nov 2012 14:27:35 -0400 Message-ID: Subject: need example for Perl STOMP access to ActiveMQ.Statistics.Broker To: users@activemq.apache.org Content-Type: multipart/alternative; boundary=f46d0401678f968d9804cd732dd8 X-Virus-Checked: Checked by ClamAV on apache.org --f46d0401678f968d9804cd732dd8 Content-Type: text/plain; charset=ISO-8859-1 I'm new to ActiveMQ and STOMP and am trying to get a simple example to work in order to retrieve system and queue information from a running server. I have read the information on: Apache ActiveMQ > Connectivity > Protocols > Stomp and I have enabled STOMP inside ActiveMQ. I know this works because I was able to use the STOMP example provide in ActiveMQ. I have also read Apache ActiveMQ > Features > Interceptors > StatisticsPlugin and tested it using a version of the (non-STOMP) code I found at: http://rajdavies.blogspot.ca/2009/10/query-statistics-for-apache-activemq.html So I know STOMP works, and I know the stats works, but I haven't gotten a Java based STOMP app (retrieving stats) to work yet, or (my ultimate goad) a Perl (AnyEvent::Stomp) based app either. So far, below is my best attempt at a Perl example and below that is my non-working Java attempt. Does anyone have a working example of either language that I can start from and learn from; or can anyone tell me what I'm missing or doing wrong? TIA Fulko use AnyEvent; use AnyEvent::STOMP; my $host = 'localhost'; my $port = undef; my $ack = undef; my $destination = '/queue/ActiveMQ.Statistics.Broker'; my $replyto = '/queue/statsresults'; my $once = 0; my $client = AnyEvent::STOMP->connect( $host, $port, $ssl, $replyto, $ack, undef, { receipt => '', transformation => 'jms-map-json', } ); $client->reg_cb(MESSAGE => sub { my (undef, $body, $headers) = @_; print "received something, body:\n$body\n"; }); $client->reg_cb(frame => sub { my (undef, $type, $body, $headers) = @_; print "received anything, type: $type\nbody:\n"; if ($type eq 'RECEIPT') { unless ($once) { $client->send('', $destination, { replyTo => $replyto, receipt => ''} ); # trigger an exchange $once = 1; } } }); AnyEvent->condvar->recv; # start the event loop import org.apache.activemq.transport.stomp.Stomp; import org.apache.activemq.transport.stomp.StompConnection; import org.apache.activemq.transport.stomp.StompFrame; import org.apache.activemq.transport.stomp.Stomp.Headers.Subscribe; import java.util.HashMap; public class StompStats { public static void main(String args[]) throws Exception { HashMap headers = new HashMap(); headers.put("replyTo", "/queue/statsresults"); StompConnection connection = new StompConnection(); connection.open("localhost", 61613); connection.connect("system", "manager"); connection.subscribe("/queue/statsresults"); connection.send("/queue/ActiveMQ.Statistics.Broker", "", "", headers); StompFrame message = connection.receive(); System.out.println(message.getBody()); connection.disconnect(); } } --f46d0401678f968d9804cd732dd8--