Session.unsubscribe does not clear JMS messages from the database
-----------------------------------------------------------------
Key: JBAS-1547
URL: http://jira.jboss.com/jira/browse/JBAS-1547
Project: JBoss Application Server
Type: Bug
Components: JMS service
Versions: JBossAS-4.0.1 Final
Environment: Windows XP
JDK 1.5.0
MS SQL Server
Reporter: Plamen Todorov
I am testing durable topic subscription and have the following issue:
session.unsubscribe("") clears the subscription from the database, but does not
clear the JMS messages stored for this subscription from the JMS_MESSAGES
table. I am using MS SQL Server 2000 to store the messages. Here is my test
code:
public Result testTopic(TopicJMSPerformanceTestSetup setup){
try{
boolean guaranteed = setup.isGuaranteed();
long t = System.currentTimeMillis();
log("Testing " + (guaranteed ? " guaranteed" : " non-guaranteed") +
" topic connection delivery...");
TopicConnectionFactory factory =
connector.getTopicConnectionFactory();
TopicConnection conn;
try{
conn = factory.createTopicConnection(
connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_USERNAME),
connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_PASSWORD));
log("Connected as " +
connector.getJMSProperty(ContextJMSConnector.JMS_PROPERTY_CONNECTION_USERNAME)
+ " Topic connection: " + conn);
}catch(JMSConnectorException ex){
conn = factory.createTopicConnection();
log("Connected using the default user credentials. Topic
connection: " + conn);
}
conn.start();
try{
log("Topic connection: " + conn);
TopicSession session = conn.createTopicSession(false,
Session.AUTO_ACKNOWLEDGE);
log("Topic session: " + session);
int mode = (guaranteed ? DeliveryMode.PERSISTENT :
DeliveryMode.NON_PERSISTENT);
TopicPublisher publisher =
session.createPublisher(connector.getTopic(TOPIC_INTERNAL_NAME));
publisher.setDeliveryMode(mode);
log("Message publisher: " + publisher);
TopicSubscriber subscriber = null;
if(guaranteed)
subscriber =
session.createDurableSubscriber(connector.getTopic(TOPIC_INTERNAL_NAME),
"testDurableSubscriber");
else
subscriber =
session.createSubscriber(connector.getTopic(TOPIC_INTERNAL_NAME));
long objectCreationTime = System.currentTimeMillis() - t;
log("Message subscriber: " + subscriber);
//flush topic messages
log("Clearing " + empty(subscriber) + " messages from the test
topic." );
long messageSendingTime = 0;
try{
log("Publishing/receiving " + setup.getIterations() +
(guaranteed? " persistent" : " non-persistent") + " messages, Size = " +
setup.getMessageSize() + " bytes...");
messageSendingTime = work(publisher, subscriber, session,
setup);
}finally{
try{
subscriber.close();
publisher.close();
}finally{
if(guaranteed)
session.unsubscribe("testDurableSubscriber");
}
session.close();
}
log("Message publishing finished. Time: " + messageSendingTime
+ " msec\n");
return new PerformanceResult(setup, objectCreationTime,
messageSendingTime);
}finally{
conn.close();
}
}catch(Exception e){
String message = "ERROR!\nError executing test. Message: " + e +
"\nTest setup: " + setup + "\nTime: " +
SimpleDateFormat.getTimeInstance().format(new Date());
log(message + "\n", Level.ERROR);
e.printStackTrace();
return new ResultImpl(message);
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
http://www.atlassian.com/software/jira
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-Development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-development