Package javax.jms

Examples of javax.jms.TopicSession.createDurableSubscriber()


        con2.close();
        publisher.publish(session1.createTextMessage("Hello2"));
        session1.commit();
        con2 =  (AMQConnection) getClientConnection("guest", "guest", "clientid");
        session2 = con2.createTopicSession(true, AMQSession.NO_ACKNOWLEDGE);
        sub = session2.createDurableSubscriber(topic, "subscription0");
        con2.start();
        tm = (TextMessage) sub.receive(2000);
        session2.commit();
        assertNotNull(tm);
        assertEquals("Hello2", tm.getText());
View Full Code Here


            BDBStoreUpgradeTestPreparer.publishMessages(pubSession, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "true");
            pubSession.commit();
            assertEquals("DurableSubscription backing queue should now have 2 messages on it",
                         Integer.valueOf(2), dursubQueue.getMessageCount());

            TopicSubscriber durSub = pubSession.createDurableSubscriber(topic, SELECTOR_SUB_NAME,"testprop='true'", false);
            Message m = durSub.receive(2000);
            assertNotNull("Failed to receive an expected message", m);
            m = durSub.receive(2000);
            assertNotNull("Failed to receive an expected message", m);
            pubSession.commit();
View Full Code Here

            BDBStoreUpgradeTestPreparer.publishMessages(session, publisher, topic, DeliveryMode.PERSISTENT, 1*1024, 1, "indifferent");
            session.commit();
            assertEquals("DurableSubscription backing queue should now have 2 messages on it",
                        Integer.valueOf(2), dursubQueue.getMessageCount());

            TopicSubscriber durSub = session.createDurableSubscriber(topic, SUB_NAME);
            Message m = durSub.receive(2000);
            assertNotNull("Failed to receive an expected message", m);
            m = durSub.receive(2000);
            assertNotNull("Failed to receive an expected message", m);

View Full Code Here

                topicConnection = topicConnectionFactory.createTopicConnection();
                topicConnection.setClientID((clientId));
                topicConnection.start();
               
                topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                topicSubscriber = topicSession.createDurableSubscriber(topic, (clientId));
                topicSubscriber.setMessageListener(this);
               
            } catch (JMSException e) {
                e.printStackTrace();
            }
View Full Code Here

                topicConnection = topicConnectionFactory.createTopicConnection();
                topicConnection.setClientID((clientId));
                topicConnection.start();
               
                topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                topicSubscriber = topicSession.createDurableSubscriber(topic, (clientId));
                topicSubscriber.setMessageListener(this);
               
            } catch (JMSException e) {
                e.printStackTrace();
            }
View Full Code Here

                topicConnection = topicConnectionFactory.createTopicConnection();
                topicConnection.setClientID((clientId));
                topicConnection.start();
               
                topicSession = topicConnection.createTopicSession(false, Session.AUTO_ACKNOWLEDGE);
                topicSubscriber = topicSession.createDurableSubscriber(topic, (clientId));
                topicSubscriber.setMessageListener(this);
               
            } catch (JMSException e) {
                e.printStackTrace();
            }
View Full Code Here

            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);
            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            tsub = ts.createDurableSubscriber(topic, name);

            msg = tsub.receiveNoWait();
            Assert.assertNotNull("third message", msg);
            Assert.assertEquals("third message", new Integer(1004),
                                            ((ObjectMessage)msg).getObject());
View Full Code Here

            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);
            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            tsub = ts.createDurableSubscriber(topic, name);

            msg = tsub.receiveNoWait();
            Assert.assertNull("after unsubscription", msg);

            om = ts.createObjectMessage(new Integer(num++));
View Full Code Here

            ObjectMessage om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);
            om = ts.createObjectMessage(new Integer(num++));
            tp.publish(om);

            TopicSubscriber tsub = ts.createDurableSubscriber(topic, name);
            Message msg = tsub.receiveNoWait();

            Assert.assertNull("initial message", msg);

            om = ts.createObjectMessage(new Integer(num++));
View Full Code Here

                topic = session.createTopic(topicName);
            }
            System.out.println("Topic ready");

            // Registering as a subscriber under the topic
            TopicSubscriber subscriber = session.createDurableSubscriber(topic,"c1");
            System.out.println("Subscriber ready");

            // MyListener listener = new MyListener(readMsg, Integer.MAX_VALUE, waitTime);
            MyListener listener = new MyListener(readMsg, ackType, waitTime, clientAckNb, displayCount);
            subscriber.setMessageListener(listener);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.