Dejan, Thanks for your reply. I have been trying that... I am trying with 2
stomp connections, one that subscribes to '/temp-queue/tq' and one that
sends a message to /queue/Queue.Data with reply to as the above temp-queue.
my client code is below..
my $stomp = Net::Stomp->new( { hostname => "192.168.42.30", port => '61613'
} );
$stomp->connect();
my $stomp1 = Net::Stomp->new( { hostname => "192.168.42.30", port => '61613'
} );
$stomp1->connect();
$stomp1->subscribe(
{ destination => '/temp-queue/tq',
'ack' => 'auto',
'activemq.prefetchSize' => 1,
}
);
my %head;
$head{destination} = '/queue/Queue.Data';
$head{"reply-to"} = '/temp-queue/tq';
my $frame = Net::Stomp::Frame->new(
{ command => "SEND", headers => \%head, body => to_json(\%request) }
);
$stomp->send_frame($frame);
while (1) {
my $frame1 = $stomp1->receive_frame;
my $json1 = $frame1->body;
print "$json1\n";
}
--------
on the server, I subscribe to /queue/Queue.Data and send the reply back on
the destination that is in the reply-to header. please see server code
below...
my $stomp = Net::Stomp->new( { hostname => $broker, port => '61613' } );
$stomp->connect();
$stomp->subscribe(
{ destination => '/queue/Queue.Data',
'ack' => 'client',
'activemq.prefetchSize' => 1,
}
);
while (1) {
my $frame = $stomp->receive_frame;
if (defined($frame->headers->{"reply-to"})) {
my %head;
$head{destination} = $frame->headers->{"reply-to"};
my $frame1= Net::Stomp::Frame->new(
{ command => "SEND", headers => \%head, body => "This is the
response from server" } );
$stomp->send_frame($frame1);
}
$stomp->ack( { frame => $frame } );
}
$stomp->disconnect;
--
I see that the request is being sent and received but the reply never makes
it to the client. What am I doing wrong?
thanks
Nishant
Dejan Bosanac wrote:
>
> Hi,
>
> use /temp-topic/ or /temp-queue/ prefixes (instead of /topic/ and /queue/)
> for destination names and ActiveMQ will create temporary destinations.
>
> Cheers
> --
> Dejan Bosanac
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
>
> On Mon, Sep 7, 2009 at 3:45 AM, nmittal <[email protected]> wrote:
>
>>
>> Hi, I am trying to implement request response with a Perl Client using
>> stomp.
>> the documentation on the ActiveMQ website has sample code in JAVA that
>> created a temporary destination and then sets the replyto header to this
>> temp destination.
>> How can I create a temporary destination in Perl STOMP client. I am using
>> Net::Stomp.
>>
>> thanks for the help.
>>
>> Nishant
>> --
>> View this message in context:
>> http://www.nabble.com/PERL-STOMP%3A-How-to-Request-Response-tp25323954p25323954.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
>
>
> -----
> Dejan Bosanac
>
> Open Source Integration - http://fusesource.com/
> ActiveMQ in Action - http://www.manning.com/snyder/
> Blog - http://www.nighttale.net
>
--
View this message in context:
http://www.nabble.com/PERL-STOMP%3A-How-to-Request-Response-tp25323954p25339442.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.