Radek Kraus created AMQ-6925:

             Summary: JDBC Store - received messages from durable topic is not 
removed after unsubscribe
                 Key: AMQ-6925
                 URL: https://issues.apache.org/jira/browse/AMQ-6925
             Project: ActiveMQ
          Issue Type: Bug
          Components: JDBC
    Affects Versions: 5.15.3
            Reporter: Radek Kraus
         Attachments: JdbcStoreDurableTopicDeleteReceivedMessagesTest.java

It seems, that received messages from durable subscriber is not removed from 
JDBC persistence layer ({{ACTIVEMQ_MSGS}}), when {{unsubscribe}} operation is 

Let suppose following scenario:
  * create (register) durable topic subscriber
  * close durable topic subscriber, but leave it "subscribed"
  * send 10 messages to topic
  * check count messages in JDBC store (10 is expected)
  * create (open) durable topic subscriber again and receive 10 messages (no 
next messages is prepared)
  * "unsubscribe" durable topic subscriber ({{session.unsubscribe(...)}})
  * check count of messages in JDBC store (0 is expected, but 10 is a reality)

IMHO there is a problem, that {{session.unsubscribe()}} only removes entry from 
{{ACTIVEMQ_ACKS}} table ({{topicStore.deleteSubscription(...)}}). It means that 
messages, which are currently present in {{ACTIVEMQ_MSGS}} table are never 
removed, because the delete statement in {{JDBCPersistenceAdapter.cleanup()}} 
method joins {{ACTIVEMQ_ACKS}} table (but subscription was already removed).

The "Removing inactive subscribers" has no effect to this test case, because 
durable subscription is removed from {{TopicRegion.durableSubscriptions}} 
field, when {{session.unsubscribe(...)}} method is invoked.

Very simple test case is attached.

This message was sent by Atlassian JIRA

Reply via email to