829830831832833834835836837838839
try { MessageConsumer cons = sess.createDurableSubscriber(topic, subName); cons.close(); sess.unsubscribe(subName); log.trace("Successfully created and unsubscribed subscription"); return true; } catch (JMSSecurityException e) {
25812582258325842585258625872588258925902591
assertEquals(NUM_MESSAGES, count); durable.close(); sess1.unsubscribe("mySubscription"); } finally { if (conn1 != null) {
26382639264026412642264326442645264626472648
producer.send(tm); } log.debug("all " + NUM_MESSAGES + " messages sent"); sess2.unsubscribe("mySubscription1"); log.debug("unsubscribed 'mySubscription1'"); conn2.close();
27802781278227832784278527862787278827892790
} log.debug("unsubscribing mySubscription"); durable.close(); sess5.unsubscribe("mySubscription"); log.debug("unsubscribing done"); conn5.close(); // Resubscribe with the same name conn6 = cf.createConnection();
29092910291129122913291429152916291729182919
assertEquals(NUM_MESSAGES - NUM_TO_RECEIVE, count); durable2.close(); sess2.unsubscribe("mySubscription"); } finally { if (conn1 != null) {
29982999300030013002300330043005300630073008
assertEquals(0, count); durable2.close(); sess2.unsubscribe("mySubscription"); } finally { if (conn1 != null) {
30333034303530363037303830393040304130423043
Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); try { sess1.unsubscribe("non-existent subscription"); fail(); } catch (JMSException e) { }
453454455456457458459460461462463
prod.send(s.createTextMessage("one")); log.debug("unsubscribing ..."); cons.close(); s.unsubscribe("uzzi"); log.debug("resubscribing ..."); MessageConsumer ds = s.createDurableSubscriber(topic, "uzzi"); conn.start();
464465466467468469470471472473474
assertNull(ds.receive(1000)); ds.close(); s.unsubscribe("uzzi"); conn.close(); } public void testInvalidSelectorException() throws Exception
506507508509510511512513514515516
TopicSubscriber dursub = s.createDurableSubscriber(topic, "dursub0"); try { s.unsubscribe("dursub0"); fail(); } catch (IllegalStateException e) { //Ok - it is illegal to ubscribe a subscription if it has active consumers