Details
-
Bug
-
Resolution: Can't Do
-
Major
-
None
-
JBossAS-4.0.1 Final
-
None
Description
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
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
finally{
try
finally
{ if(guaranteed) session.unsubscribe("testDurableSubscriber"); } session.close();
}
log("Message publishing finished. Time: " + messageSendingTime + " msec\n");
return new PerformanceResult(setup, objectCreationTime, messageSendingTime);
}finally
}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); }}