[rabbitmq-discuss] virtualhost in stomp

Javier Marcon javiermarcon at gmail.com
Wed Dec 12 16:47:56 GMT 2012


I have a working perl application (with Net::STOMP plugin) that sends
messages with normal queues and also with topic, that uses the default
virtualhost. I am triying to move that application to a virtualhost. I
created the virtualhost and the user (assigning the tag Admin and regexp
.* to all permissions) from rabbitmq web interface but I have some problems:

1) When I try to create the queues for the new virtualhost, the web
interface asks me the user and password and even putting the right
user/password combination (with new user or with guest), it keeps asking
me the user/password. How can I solve it?

2) when I try to connect send a message with the scrpts listed below, I
get the "You must log in using CONNECT first" error. (but connecting
returns an object). What am I doing wrong?

send:

#!/usr/bin/perl -w

# send a message to the queue 'foo'

use Net::Stomp;

my $stomp = Net::Stomp->new({hostname=>'localhost', port=>'61613'});

$stomp->connect({login=>'miusuario', passcode=>'mipass', "virtual-host"=>'/mihost'});

$stomp->send({destination=>'/queue/foo',

	      bytes_message=>1,

	      body=>($ARGV[0] or "test\0message")});
$stomp->disconnect;


recive:

#!/usr/bin/perl -w

# subscribe to messages from the queue 'foo'

use Net::Stomp;

my $stomp = Net::Stomp->new({hostname=>'localhost', port=>'61613'});

$stomp->connect({login=>'miusuario', passcode=>'mipass', "virtual-host"=>'/mihost'});

$stomp->subscribe({'destination'=>'/queue/foo', 'ack'=>'client'});

while (1) {

     my $frame = $stomp->receive_frame;

     print $frame->body . "\n";

     $stomp->ack({frame=>$frame});

     last if $frame->body eq 'QUIT';

}

$stomp->disconnect;


Thanks,

Javier.


More information about the rabbitmq-discuss mailing list