activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandeep Chayapathi <>
Subject ActiveMQ and REST
Date Thu, 28 Jun 2007 18:47:47 GMT

Hi all,
 Recently I started trying out accessing messages via the REST protocol. I
have successfully setup a network transport for http on port 8080 and I can
see the jetty webserver responding to queries.

 However I have hit a roadblock with accessing the messages itself. The REST  documentation is very
sparse and most of the posts in the user forum isn't encouraging either. 

 Using the script given below, all I get is the following xml response:


 The questions are:

1. has anyone successfully used the REST api, if so how ?
2. any links to a working code (other than using the AjaxServlet) ?


Here is a simple perl script that tries to subscribe to a queue and get

#!/usr/bin/perl -w
use strict;
use LWP::UserAgent;
use HTTP::Request;

my $client_id = "foo4";
my $amq_server = "http://localhost:8080";
my $queue = "queue/test";

my $ua = LWP::UserAgent->new();

my $req = HTTP::Request->new(HEAD=> "$amq_server");
$req->header( clientID => $client_id);

print "HEAD request\n";


$req = HTTP::Request->new(POST=> "$amq_server/subscribe/$client_id/$queue");
$req->header( clientID => $client_id);

print "SUBSCRIBE request\n";


print "GET request\n";

$req = HTTP::Request->new(GET => "$amq_server/$queue");
$req->header( clientID => $client_id);


sub get_data(){
    my $req = shift;

    my $res = $ua->request($req);
    # Check the outcome of the response
    if ($res->is_success) {
        print $res->content;
    }else {
        print $res->status_line, "\n";
View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message