Package javax.jms

Examples of javax.jms.Session.createTopic()


        setTestClientSystemProperty("qpid.default_mandatory","true");
        Session session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

        // publish to non-existent topic - should get mandatory failure

        MessageProducer producer = session.createProducer(session.createTopic(getTestQueueName()));
        Message message = session.createMessage();
        producer.send(message);

        _testExceptionListener.assertReceivedNoRouteWithReturnedMessage(message, getTestQueueName());
View Full Code Here


        // now set topic specific system property to false - should no longer get mandatory failure on new producer
        setTestClientSystemProperty("qpid.default_mandatory_topic","false");
        producer = session.createProducer(null);
        message = session.createMessage();
        producer.send(session.createTopic(getTestQueueName()), message);

        _testExceptionListener.assertNoException();
    }
}
View Full Code Here

      if (HornetQRASession.trace)
      {
         HornetQRASession.log.trace("createTopic " + session + " topicName=" + topicName);
      }

      Topic result = session.createTopic(topicName);

      if (HornetQRASession.trace)
      {
         HornetQRASession.log.trace("createdTopic " + session + " topic=" + result);
      }
View Full Code Here

    public void testConsumer() throws Exception{
        factory = createConnectionFactory();
        Connection consumerConnection = factory.createConnection();
        consumerConnection.setClientID(CONSUMER_NAME);
        Session consumerSession = consumerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic  = consumerSession.createTopic(getClass().getName());
        MessageConsumer consumer = consumerSession.createDurableSubscriber(topic, CONSUMER_NAME);
        consumerConnection.start();
        consumerConnection.close();
        broker.stop();
        broker =createBroker(false);
View Full Code Here

        LOG.info("Starting broker..");
    }

    private void buildReceiver(Connection connection, final String queueName, boolean transacted, final Receiver receiver, boolean isTopic) throws Exception {
        final Session session = transacted ? connection.createSession(true, Session.SESSION_TRANSACTED) : connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        MessageConsumer inputMessageConsumer = session.createConsumer(isTopic ? session.createTopic(queueName) : session.createQueue(queueName));
        MessageListener messageListener = new MessageListener() {

            public void onMessage(Message message) {
                try {
                    ObjectMessage objectMessage = (ObjectMessage)message;
View Full Code Here

        assertNotNull(msg);
    }
   
    public void xtestMessageDiscardedAdvisory() throws Exception {
        Session s = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Topic topic = s.createTopic(getClass().getName());
        MessageConsumer consumer = s.createConsumer(topic);
               
        Topic advisoryTopic = AdvisorySupport.getMessageDiscardedAdvisoryTopic((ActiveMQDestination) topic);
        MessageConsumer advisoryConsumer = s.createConsumer(advisoryTopic);
        //start throwing messages at the consumer
View Full Code Here

    public void testDurableTopicSessionCloseMarksMessageRedelivered() throws JMSException {
        connection.setClientID(getName());
        connection.start();

        Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Topic topic = session.createTopic("topic-" + getName());
        MessageConsumer consumer = session.createDurableSubscriber(topic, "sub1");

        // This case only works with persistent messages since transient
        // messages
        // are dropped when the consumer goes offline.
View Full Code Here

    public void testDurableTopicRecoverMarksMessageRedelivered() throws JMSException {
        connection.setClientID(getName());
        connection.start();

        Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Topic topic = session.createTopic("topic-" + getName());
        MessageConsumer consumer = session.createDurableSubscriber(topic, "sub1");

        MessageProducer producer = createProducer(session, topic);
        producer.send(createTextMessage(session));
View Full Code Here

    public void testDurableTopicRollbackMarksMessageRedelivered() throws JMSException {
        connection.setClientID(getName());
        connection.start();

        Session session = connection.createSession(true, Session.CLIENT_ACKNOWLEDGE);
        Topic topic = session.createTopic("topic-" + getName());
        MessageConsumer consumer = session.createDurableSubscriber(topic, "sub1");

        MessageProducer producer = createProducer(session, topic);
        producer.send(createTextMessage(session));
        session.commit();
View Full Code Here

        connection.setClientID(getName());
        connection.start();

        Session session = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE);
        Topic topic = session.createTopic("topic-" + getName());
        MessageConsumer consumer = session.createConsumer(topic);

        MessageProducer producer = createProducer(session, topic);
        producer.send(createTextMessage(session));
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.