Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I use transactions with Stomp and ActiveMQ (and Perl)?

I'm trying to replace some bespoke message queues with ActiveMQ, and I need to talk to them (a lot) from Perl. ActiveMQ provides a Stomp interface and Perl has Net::Stomp, so this seems like it should be fine, but it's not.

Even if I send a BEGIN command over Stomp, messages sent with SEND are immediately published, and if I ABORT the transaction, nothing happens.

I can't find any clear answers suggesting that suggest it's not possible, that is is possible, or that there's a relevant bit of configuration. Also, Stomp doesn't seem to be a great protocol for checking for error responses from the server.

Am I out of luck?

like image 567
rjbs Avatar asked Sep 17 '08 02:09

rjbs


People also ask

Does ActiveMQ support Stomp?

ActiveMQ supports the Stomp protocol and the Stomp - JMS mapping. This makes it easy to write a client in pure Ruby, Perl, Python or PHP for working with ActiveMQ.

What is Stomp in ActiveMQ?

STOMP is a text-orientated wire protocol that allows STOMP clients to communicate with STOMP Brokers. Apache ActiveMQ Artemis supports STOMP 1.0, 1.1 and 1.2. STOMP clients are available for several languages and platforms making it a good choice for interoperability.


1 Answers

BTW the best place to ask Perl/ActiveMQ/Stomp questions is the ActiveMQ user forum as lots of Perl-Stomp folks hang out there.

The trick with STOMP transactions is to make sure each message you send or each acknowledgement you make includes the transaction ID header. See the transaction handling section of the STOMP protocol.

The reason for this is that with STOMP you could have many transactions taking place at the same time if your client is multi threaded - along with some non-transacted operations.

like image 152
James Strachan Avatar answered Oct 05 '22 04:10

James Strachan