activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kevin Goess <k...@goess.org>
Subject Net::Stomp and transactions and receive_frame()
Date Mon, 26 Sep 2011 12:42:21 GMT
I'm in the process of adapting some existing code using Net::Stomp from being
able to handle a single topic to being able to work on multiple topics.  Can
anyone tell me if this approach is even possible?  It's not working now
because where it expects a transaction receipt, it's getting the first
message on another topic.  I'd like to know if I'm just barking up the wrong
tree before I go about trying to fix it.

Here's what the workflow looks like:

# first subscribe to three different queues
for $job (qw/ JOB1 JOB2 JOB3 /){
$stomp->subscribe({
   "ack" => "client",
   "destination" => "/queue/$job"
});

while($stomp->can_read){

   $frame = $stomp->receive_frame();

   # ... receives a message for JOB1
   # and to start a transaction sends a BEGIN frame that looks like this:

    bless({
    command => "BEGIN",
    headers => {
             receipt => "0002",
            transaction => "0001",
       },
    }, "Net::Stomp::Frame")
   
   # Then looks for a receipt on that frame by calling
   $receipt = $stomp->receive_frame()

Unfortunately, where it's expecting a RECEIPT frame, it actually gets a
MESSAGE frame from the JOB2 queue.

My question is, is there any way for that to work, to be both subscribed to
multiple topics and to be able to receive receipts on transactions?  Or is
there a better/more standard way to handle it?

Any tips or suggestions would be most welcome, thanks!



--
View this message in context: http://activemq.2283324.n4.nabble.com/Net-Stomp-and-transactions-and-receive-frame-tp3843640p3843640.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message