Issue Details (XML | Word | Printable)

Key: AMQ-1807
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Critical Critical
Assignee: Dejan Bosanac
Reporter: Celso Pinto
Votes: 3
Watchers: 6
Operations

If you were logged in you would be able to see more operations.
ActiveMQ

Activemq stops dispatching messages aborting transaction (STOMP)

Created: 18/Jun/08 03:12 AM   Updated: 19/Aug/09 04:37 AM
Return to search
Component/s: Transport
Affects Version/s: 5.1.0
Fix Version/s: 5.3.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works stomp_test.patch 2008-06-30 05:00 PM Celso Pinto 3 kB
Environment: Linux, JDK 1.6_06b2


 Description  « Hide
As requested by Dejan Bosanac, I'm adding this ticket. I'm willing to help fix it, ie. I can get my hands dirty, but I must have some pointers on where to look because (unfortunately) I don't have much time to learn ActiveMQ's internals and architecture.

A copy of the email I sent to the users mailing-list:
=============================================

I'm currently struggling to understand the reason behind that's causing the behaviour described in the subject: I'm connecting to activemq via stomp on a python app. Because I need to have the messages rolled back in case of some processing failure I'm wrapping the message processing in the following way:

message received -> start transaction -> ack message in transaction ->
process message -> if no exception commit tx, else rollback transaction

AFAIK, this is the only way of making message unacknowledgement possible with stomp. Also, this is a single client connection, ie. I'm using a
single client connection to create a message processing daemon, all messages are sent and received via this single connection to the MQ server.

Here's a telnet session that can be used to reproduce the problem (open jconsole and send 5 text messages to the queue):

% telnet localhost 61613
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
CONNECT

^@
CONNECTED
session:ID:starfish-53281-1213736462979-2:2

SUBSCRIBE
destination: /queue/testq
ack: client
activemq.prefetchSize: 1

^@
MESSAGE
message-id:ID:starfish-53281-1213736462979-3:3:1:1:1
destination:/queue/testq
timestamp:1213736837743
expires:0
priority:0

1
BEGIN
transaction: 1

^@
ACK
message-id:ID:starfish-53281-1213736462979-3:3:1:1:1
transaction: 1

^@
MESSAGE
message-id:ID:starfish-53281-1213736462979-3:4:1:1:1
destination:/queue/testq
timestamp:1213736840224
expires:0
priority:0

2
MESSAGE
message-id:ID:starfish-53281-1213736462979-3:5:1:1:1
destination:/queue/testq
timestamp:1213736842611
expires:0
priority:0

3
ABORT
transaction: 1

^@
BEGIN
transaction:2

^@
ACK
message-id:ID:starfish-53281-1213736462979-3:4:1:1:1
transaction:2

^@
ABORT
transaction:2

^@
ACK
message-id:ID:starfish-53281-1213736462979-3:5:1:1:1

^@

I see a couple of issues here:

#1) even though I specified activemq.prefetchSize to 1 in the subscription command, the connector dispatches two messages in a row

#2) no more messages are dispatched after aborting the transaction/acknowledging the last received message. Even if the second message isn't wrapped in a transaction, message dispatch stops there.

To add to the confusion, if I don't use transactions at all, my client keeps getting messages, one by one, ie. no two messages are sent together, I only get a new message after ACK'ing the previous one.

I think I may be stepping into the realms of a buggy STOMP connector. Please tell me if I'm missing something obvious that fixes this issue
(hence making it a non-issue) or if indeed the STOMP connector has problems.



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Repository Revision Date User Message
AMQ #727017 Tue Dec 16 03:02:28 PST 2008 dejanb fix for prefetch size issue reported in AMQ-1807
Files Changed
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
MODIFY /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Repository Revision Date User Message
AMQ #738904 Thu Jan 29 08:01:35 PST 2009 dejanb fix for https://issues.apache.org/activemq/browse/AMQ-1807
Files Changed
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
MODIFY /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java

Repository Revision Date User Message
AMQ #801243 Wed Aug 05 07:46:25 PDT 2009 dejanb improved test case for for https://issues.apache.org/activemq/browse/AMQ-1807 - stomp dispatching
Files Changed
MODIFY /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Repository Revision Date User Message
AMQ #804192 Fri Aug 14 05:29:58 PDT 2009 dejanb https://issues.apache.org/activemq/browse/AMQ-1807 - aborting transaction test revisited + solution
Files Changed
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
MODIFY /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Repository Revision Date User Message
AMQ #804943 Mon Aug 17 04:43:34 PDT 2009 dejanb additional fix for https://issues.apache.org/activemq/browse/AMQ-1807 - fixing test case and making it work
Files Changed
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompConnection.java
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/region/PrefetchSubscription.java
MODIFY /activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
MODIFY /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java