activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frederick Grim <fg...@wssource.com>
Subject http, rest jetty interface
Date Thu, 28 Jun 2007 19:14:48 GMT
Howdy,
    I am trying to write a javascript app that talks HTTP to the jetty 
interface.  The problem here is that the documentation is unclear how to 
do this.  Essentially what I want to do is have an app write messages to 
a topic and my javascript make calls back to the jetty interface.  I am 
using apache as a reverse proxy so the ajax calls will work.  No matter 
what I do I cannot seem to read a a message off a given topic.  The page 
http://activemq.apache.org/rest-protocols.html has information that is, 
apprently, flatly wrong.  If someone could just show me a curl session 
that pulls messages of a given session that would probably clear up all 
my confusion. 


My javascript looks like (I am using mochikit)

AMQPuller = function() {
    bindMethods(this);
}

AMQPuller.prototype.initialize = function() {
    /* First thing we do is build the initial POST so we can start 
polling */
    log('init');
    var def = doXHR('http://' + location.host + 
'/proxy/subscribe/feg208/earnings', { 'method':'HEAD',
        'headers':{ 'clientID':'feg208' } } ).addCallback(this.Poll);
    def.addErrback(this.HandleError);
}

AMQPuller.prototype.HandleError = function(err) {
    swapDOM('center', P({ 'id':'center' }, err));
}

AMQPuller.prototype.MakeRequest = function() {
    var def = doXHR('http://' + location.host + 
'/proxy/message/feg208/1', { 'method':'GET',
        'queryString':{ 'timeout':'0', 'destination':'earnings', 
'type':'topic' }, 'headers': { 'clientID':'feg208' } } );
    def.addCallback(this.ProcessResponse);
    return def;
}

AMQPuller.prototype.ProcessResponse = function(resp) {
    swapDOM('center', P({ 'id':'center' }, resp.responseText));
    this.Poll();
}

AMQPuller.prototype.Poll = function() {
    var def = wait(15).addCallback(this.MakeRequest);
    def.addErrback(this.HandleError);
}

AMQPuller.prototype.Unsubscribe = function() {
    var def = doXHR('http://' + location.host + 
'/proxy/unsubscribe/feg208/earnings', { 'method':'HEAD',
        'headers':{ 'clientID':'feg208' } } ).addErrback(this.HandleError);
    return def;
}

amqpuller = new AMQPuller();
addLoadEvent(amqpuller.initialize);


and my local apache config looks like:
<VirtualHost *:80>
    DocumentRoot "/home/hal9000/static"
    ServerName local-modperl.wssource.com
    ServerAlias local.wssource.com
    CustomLog /var/log/apache2/local-modperl.wssource.com-access_log 
combined
    ErrorLog /var/log/apache2/local-modperl.wssource.com-error_log
    ProxyRequests off
    ProxyPass /proxy/ http://192.168.1.15:8080/
    <Location /proxy/>
        ProxyPassReverse /
    </Location>
    <Location "/">
        Options Indexes FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Location>
</VirtualHost>


Thanks for the time.

    Fred

Mime
View raw message