Package javax.jms

Examples of javax.jms.ConnectionFactory


    */
   public void testClientCrash() throws Exception
   {
      InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
     
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      Queue queue = (Queue)ic.lookup("/queue/Queue");
     
      CreateClientOnServerCommand command = new CreateClientOnServerCommand(cf, queue, true);
     
View Full Code Here


   public void testClientCrashWithTwoConnections() throws Exception
   {
      InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
      Topic topic = (Topic)ic.lookup("/topic/Topic");
     
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      CreateTwoClientOnServerCommand command = new CreateTwoClientOnServerCommand(cf, topic, true);
     
      String remotingSessionId[] = (String[])remoteServer.executeCommand(command);
     
View Full Code Here

      ObjectName on = ServerManagement.deploy(mbeanConfig);
      ServerManagement.invoke(on, "create", new Object[0], new String[0]);
      ServerManagement.invoke(on, "start", new Object[0], new String[0]);
     
      ConnectionFactory myCF = (ConnectionFactory)initialContext.lookup("/mycf");
     
      Connection conn = myCF.createConnection();

      Session producerSess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer producer = producerSess.createProducer(queue);

      Session consumerSess = conn.createSession(false, Session.DUPS_OK_ACKNOWLEDGE);
View Full Code Here

    */
   public void testClientCrash() throws Exception
   {
      InitialContext ic = new InitialContext(InVMInitialContextFactory.getJNDIEnvironment());
     
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
     
      Queue queue = (Queue)ic.lookup("/queue/Queue");
     
      CreateClientOnServerCommand command = new CreateClientOnServerCommand(cf, queue, true);
     
View Full Code Here

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

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

      Connection conn = cf.createConnection();

      conn.close();
   }
View Full Code Here

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


   public void testMessagesSentDuringClose() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("/ConnectionFactory");
      Queue queue = (Queue)ic.lookup("/queue/ConsumerClosedTestQueue");

      Connection c = cf.createConnection();
      c.start();

      Session s = c.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer p = s.createProducer(queue);
View Full Code Here

      super.tearDown();
   }

   public void testSimplestDurableSubscription() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/Topic");
      Connection conn = cf.createConnection();

      conn.setClientID("brookeburke");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = s.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);

      s.createDurableSubscriber(topic, "monicabelucci");

      ObjectName destObjectName =
         new ObjectName("jboss.messaging.destination:service=Topic,name=Topic");
      List subs = (List)ServerManagement.invoke(destObjectName, "listAllSubscriptions", null, null);
     
      assertNotNull(subs);
     
      assertEquals(1, subs.size());
     
      SubscriptionInfo info = (SubscriptionInfo)subs.get(0);

      assertEquals("monicabelucci", info.getName());

      prod.send(s.createTextMessage("k"));

      conn.close();

      subs = (List)ServerManagement.invoke(destObjectName, "listAllSubscriptions", null, null);

      assertEquals(1, subs.size());
     
      info = (SubscriptionInfo)subs.get(0);

      assertEquals("monicabelucci", info.getName());

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

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

      MessageConsumer durable = s.createDurableSubscriber(topic, "monicabelucci");
View Full Code Here

    */
   public void testDurableSubscriptionOnNewTopic() throws Exception
   {
      ServerManagement.deployTopic("CompletelyNewTopic");

      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/CompletelyNewTopic");
      Connection conn = cf.createConnection();

      conn.setClientID("brookeburke");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = s.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);

      s.createDurableSubscriber(topic, "monicabelucci");

      prod.send(s.createTextMessage("one"));

      conn.close();

      ServerManagement.deployTopic("CompletelyNewTopic2");

      Topic topic2 = (Topic)ic.lookup("/topic/CompletelyNewTopic2");
      conn = cf.createConnection();

      conn.setClientID("brookeburke");

      s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageConsumer durable = s.createDurableSubscriber(topic2, "monicabelucci");
View Full Code Here

    */
   public void testDurableSubscriptionDifferentSelector() throws Exception
   {
      ServerManagement.deployTopic("CompletelyNewTopic2");
     
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Topic topic = (Topic)ic.lookup("/topic/Topic");
      Connection conn = cf.createConnection();

      conn.setClientID("brookeburke");

      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      MessageProducer prod = s.createProducer(topic);
      prod.setDeliveryMode(DeliveryMode.PERSISTENT);

     
      //fails here
      MessageConsumer durable =
         s.createDurableSubscriber(topic,
                                   "monicabelucci",
                                   "color = 'red' AND shape = 'square'",
                                   false);

      TextMessage tm = s.createTextMessage("A red square message");
      tm.setStringProperty("color", "red");
      tm.setStringProperty("shape", "square");
      prod.send(tm);

      conn.start();

      TextMessage rm = (TextMessage)durable.receive(5000);
      assertEquals("A red square message", rm.getText());

      tm = s.createTextMessage("Another red square message");
      tm.setStringProperty("color", "red");
      tm.setStringProperty("shape", "square");
      prod.send(tm);

      // TODO: when subscriptions/durable subscription will be registered as MBean, use the JMX
      //       interface to make sure the 'another red square message' is maintained by the
      //       durable subascription
      //       http://jira.jboss.org/jira/browse/JBMESSAGING-217

      conn.close();

      conn = cf.createConnection();

      conn.setClientID("brookeburke");

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

View Full Code Here

//      assertNull(m);
//   }

   public void testDurableSubscriptionOnTemporaryTopic() throws Exception
   {
      ConnectionFactory cf = (ConnectionFactory)ic.lookup("ConnectionFactory");
      Connection conn = cf.createConnection();
      conn.setClientID("doesn't actually matter");
      Session s = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
      Topic temporaryTopic = s.createTemporaryTopic();

      try
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.