Package javax.jms

Examples of javax.jms.ConnectionFactory


         // OK
      }

      ServerManagement.deployTopic("TopicToBeRedeployed");

      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/TopicToBeRedeployed");

      Connection conn = cf.createConnection();
      conn.setClientID("brookeburke");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = s.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);
      MessageConsumer ds = s.createDurableSubscriber(topic, "monicabelucci");
      conn.start();

      prod.send(s.createTextMessage("one"));
      prod.send(s.createTextMessage("two"));
     
      TextMessage tm = (TextMessage)ds.receive();
      assertEquals("one", tm.getText());
      conn.close();

      ServerManagement.undeployTopic("TopicToBeRedeployed");
      log.debug("topic undeployed");

      try
      {
         topic = (Topic)ic.lookup("/topic/TopicToBeRedeployed");
         fail("should throw exception");
      }
      catch(NamingException e)
      {
         // OK
      }

      conn = cf.createConnection();
      conn.setClientID("brookeburke");

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

      try
View Full Code Here


      ServerManagement.undeployTopic("TopicToBeRedeployed");
   }

   public void testUnsubscribeDurableSubscription() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/Topic");

      Connection conn = cf.createConnection();
      conn.setClientID("ak47");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer cons = s.createDurableSubscriber(topic, "uzzi");
      MessageProducer prod = s.createProducer(topic);
View Full Code Here

      conn.close();
   }

   public void testInvalidSelectorException() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/Topic");
      Connection c = cf.createConnection();
      c.setClientID("sofiavergara");
      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);

      try
      {
View Full Code Here


   //See JMS 1.1. spec sec 6.11
   public void testUnsubscribeWithActiveConsumer() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/Topic");

      Connection conn = cf.createConnection();
      conn.setClientID("zeke");

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

      TopicSubscriber dursub = s.createDurableSubscriber(topic, "dursub0");
View Full Code Here

        this.joramAdapter.createCF("CF");
        this.joramAdapter.createQueueCF("QCF");
        this.joramAdapter.createTopicCF("TCF");

        // Create connection factories  that will be used by a pure JMS Client
        ConnectionFactory jcf = null;
        TopicConnectionFactory jtcf = null;
        QueueConnectionFactory jqcf = null;

        String name = CONN_FACT_NAME;
        try {
View Full Code Here

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

   public void testForeignByteMessage() throws Exception
   {
      ConnectionFactory cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");

      Connection c =  cf.createConnection();
      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue)ic.lookup("/queue/Queue");
     
      drainDestination(cf, queue);
     
View Full Code Here

      c.close();
   }

   public void testJMSMessageIDChanged() throws Exception
   {
      ConnectionFactory cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");

      Connection c =  cf.createConnection();
      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Queue queue = (Queue)ic.lookup("/queue/Queue");
      MessageProducer p = s.createProducer(queue);

      Message m = new SimpleJMSMessage();
View Full Code Here

      qc.close();
   }

   public void testInvalidSelectorOnDurableSubscription() throws Exception
   {
      ConnectionFactory cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
      Connection c =  cf.createConnection();
      c.setClientID("something");
      try
      {
         Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
         Topic topic = (Topic)ic.lookup("/topic/Topic");
View Full Code Here

      ServerManagement.undeployQueue("Queue");
      ServerManagement.undeployTopic("Topic");
      ServerManagement.deployQueue("Queue");
      ServerManagement.deployTopic("Topic");
     
      ConnectionFactory cf = (JBossConnectionFactory)ic.lookup("/ConnectionFactory");
      Queue queue = (Queue)ic.lookup("/queue/Queue");

      drainDestination(cf, queue);

      log.debug("setup done");
View Full Code Here

      // we don't want to mess with JNDI, read the connection factory and the queue from their
      // serialized format, from disk
      ObjectInputStream ois =
         new ObjectInputStream(new FileInputStream(serializedFileName));
      ConnectionFactory cf =(ConnectionFactory)ois.readObject();
      Queue queue = (Queue)ois.readObject();

      ois.close();

      Connection conn = cf.createConnection();
      Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = sess.createProducer(queue);
      MessageConsumer cons = sess.createConsumer(queue);

      prod.send(sess.createTextMessage(ClientExitTest.MESSAGE_TEXT));
View Full Code Here

TOP

Related Classes of javax.jms.ConnectionFactory

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.