Package javax.jms

Examples of javax.jms.TemporaryQueue


         Session producerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         TemporaryQueue tempQueue = producerSession.createTemporaryQueue();

         MessageConsumer consumer = consumerSession.createConsumer(tempQueue);

         try
         {
            tempQueue.delete();

            ProxyAssertSupport.fail("Should throw JMSException");
         }
         catch (JMSException e)
         {
View Full Code Here


         Session consumerSession = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

         // Make sure temporary queue cannot be used after it has been deleted

         TemporaryQueue tempQueue = producerSession.createTemporaryQueue();

         MessageProducer producer = producerSession.createProducer(tempQueue);

         MessageConsumer consumer = consumerSession.createConsumer(tempQueue);

         conn.start();

         final String messageText = "This is a message";

         Message m = producerSession.createTextMessage(messageText);

         producer.send(m);

         TextMessage m2 = (TextMessage)consumer.receive(2000);

         ProxyAssertSupport.assertNotNull(m2);

         ProxyAssertSupport.assertEquals(messageText, m2.getText());

         consumer.close();

         tempQueue.delete();
         conn.close();
         conn = JMSTestCase.cf.createConnection("guest", "guest");
         try
         {
            producer.send(m);
View Full Code Here

      {
         producerConnection = JMSTestCase.cf.createConnection();

         Session producerSession = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);

         TemporaryQueue tempQueue = producerSession.createTemporaryQueue();
         String queueName = tempQueue.getQueueName();

         try
         {
            JMSTestCase.ic.lookup("/queue/" + queueName);
            ProxyAssertSupport.fail("The temporary queue should not be bound to JNDI");
View Full Code Here

   {
      Connection conn = JMSTestCase.cf.createConnection();

      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);

      TemporaryQueue tempQueue = sess.createTemporaryQueue();

      Connection anotherConn = JMSTestCase.cf.createConnection();

      Session sessFromAnotherConn = anotherConn.createSession(false, Session.AUTO_ACKNOWLEDGE);
View Full Code Here

   // Public --------------------------------------------------------

   public void testJMSDestinationSimple() throws Exception
   {
      Message m = queueProducerSession.createMessage();
      TemporaryQueue tempQ = queueProducerSession.createTemporaryQueue();
      m.setJMSReplyTo(tempQ);

      queueProducer.send(m);
      queueConsumer.receive();
      ProxyAssertSupport.assertEquals(tempQ, m.getJMSReplyTo());
View Full Code Here

            Queue queue = (Queue) initialContext.lookup(QUEUE_NAME);
            connection = cf.createConnection("guest", "guest");
            connection.start(); //for consumer we need to start connection
            session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
            MessageProducer sender = session.createProducer(queue);
            TemporaryQueue replyQueue = session.createTemporaryQueue();
            TextMessage message = session.createTextMessage("hello goodbye");
            message.setJMSReplyTo(replyQueue);
            sender.send(message);
            log.info("testSendMessage(): Message sent!");
View Full Code Here

    public void testSendMessage() throws Exception {
        ConnectionFactory connFactory = lookup("ConnectionFactory", ConnectionFactory.class);
        Connection conn = connFactory.createConnection();
        conn.start();
        Session session = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
        TemporaryQueue replyQueue = session.createTemporaryQueue();
        TextMessage msg = session.createTextMessage("Hello world");
        msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
        msg.setJMSReplyTo(replyQueue);
        Queue queue = lookup("java:jboss/" + queueName, Queue.class);
        MessageProducer producer = session.createProducer(queue);
View Full Code Here

            conn = qcf.createQueueConnection("guest", "guest");
            conn.start();
            session = conn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

            TemporaryQueue replyQueue = session.createTemporaryQueue();

            TextMessage msg = session.createTextMessage("Hello world");
            msg.setJMSDeliveryMode(DeliveryMode.NON_PERSISTENT);
            msg.setJMSReplyTo(replyQueue);
View Full Code Here

        answer.setDestinationName("temporary");
        answer.setDestinationResolver(new DestinationResolver() {

            public Destination resolveDestinationName(Session session, String destinationName,
                                                      boolean pubSubDomain) throws JMSException {
                TemporaryQueue queue = null;
                synchronized (getOutterInstance()) {
                    try {
                        queue = session.createTemporaryQueue();
                        setReplyTo(queue);
                    } finally {
View Full Code Here

        answer.setDestinationName("temporary");
        answer.setDestinationResolver(new DestinationResolver() {
            public Destination resolveDestinationName(Session session, String destinationName,
                                                      boolean pubSubDomain) throws JMSException {
                // use a temporary queue to gather the reply message
                TemporaryQueue queue = session.createTemporaryQueue();
                setReplyTo(queue);
                return queue;
            }
        });
        answer.setAutoStartup(true);
View Full Code Here

TOP

Related Classes of javax.jms.TemporaryQueue

Copyright © 2018 www.massapicom. 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.