Package org.hornetq.jms.server

Examples of org.hornetq.jms.server.JMSServerManager


   }

   protected void createQueue(final String queueName, final int index) throws Exception
   {
      JMSServerManager server = jmsServer0;
      if (index == 1)
      {
         server = jmsServer1;
      }
      server.createQueue(false, queueName, null, true, "/queue/" + queueName);
   }
View Full Code Here


      TopicConfiguration topicConfig = new TopicConfigurationImpl(RandomUtil.randomString(),
                                                                  "/topic/binding1",
                                                                  "/topic/binding2");
      jmsConfiguration.getTopicConfigurations().add(topicConfig);

      JMSServerManager server = new JMSServerManagerImpl(coreServer, jmsConfiguration);
      server.start();

      for (String binding : cfConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof ConnectionFactory);
         ConnectionFactory cf = (ConnectionFactory)o;
         Connection connection = cf.createConnection();
         connection.close();
      }

      for (String binding : queueConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof Queue);
         Queue queue = (Queue)o;
         Assert.assertEquals(queueConfig.getName(), queue.getQueueName());
      }

      for (String binding : topicConfig.getBindings())
      {
         Object o = context.lookup(binding);
         Assert.assertNotNull(o);
         Assert.assertTrue(o instanceof Topic);
         Topic topic = (Topic)o;
         Assert.assertEquals(topicConfig.getName(), topic.getTopicName());
      }

      server.stop();
   }
View Full Code Here

         final HornetQServer server = HornetQServers.newHornetQServer(conf, false);

         Hashtable<String, String> env = new Hashtable<String, String>();
         env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
         env.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
         JMSServerManager serverManager = new JMSServerManagerImpl(server);
         serverManager.setContext(new InitialContext(env));
         serverManager.start();

         System.out.println("Server started, ready to start client test");

         // create the reader before printing OK so that if the test is quick
         // we will still capture the STOP message sent by the client
View Full Code Here

   }

   protected void createQueue(final String queueName, final int index) throws Exception
   {
      JMSServerManager server = jmsServer0;
      if (index == 1)
      {
         server = jmsServer1;
      }
      server.createQueue(false, queueName, null, true, "/queue/" + queueName);
   }
View Full Code Here

        this.jndi = jndi;
    }

    /** {@inheritDoc} */
    public synchronized void start(StartContext context) throws StartException {
        final JMSServerManager jmsManager = jmsServer.getValue();
        try {
            jmsManager.createQueue(false, queueName, selectorString, durable, jndi);
        } catch (Exception e) {
            throw new StartException("failed to create queue", e);
        }
    }
View Full Code Here

        }
    }

    /** {@inheritDoc} */
    public synchronized void stop(StopContext context) {
        final JMSServerManager jmsManager = jmsServer.getValue();
        try {
            jmsManager.destroyQueue(queueName);
        } catch (Exception e) {
            Logger.getLogger("org.jboss.messaging").warnf(e ,"failed to destroy jms queue: %s", queueName);
        }
    }
View Full Code Here

    }

    /** {@inheritDoc} */
    public synchronized void start(StartContext context) throws StartException {
        try {
            final JMSServerManager jmsServer = new JMSServerManagerImpl(hornetQServer.getValue());

            final Context jndiContext = contextInjector.getOptionalValue();
            if(jndiContext != null) {
                jmsServer.setContext(jndiContext);
            }

            try {
                // FIXME - we also need the TCCL here in case the JMSServerManager starts the HornetQServer
                final ClassLoader loader = getClass().getClassLoader();
                SecurityActions.setContextClassLoader(loader);
                jmsServer.start();
            } finally {
                SecurityActions.setContextClassLoader(null);
            }
            this.jmsServer = jmsServer;
        } catch (Exception e) {
View Full Code Here

        }
    }

    /** {@inheritDoc} */
    public synchronized void stop(StopContext context) {
        final JMSServerManager jmsServer = this.jmsServer;
        this.jmsServer = null;
        try {
            jmsServer.stop();
        } catch (Exception e) {
            Logger.getLogger("org.jboss.messaging").error("exception while stopping jms server", e);
        }
    }
View Full Code Here

        }
    }

    /** {@inheritDoc} */
    public synchronized JMSServerManager getValue() throws IllegalStateException {
        final JMSServerManager jmsServer = this.jmsServer;
        if(jmsServer == null) {
            throw new IllegalStateException();
        }
        return jmsServer;
    }
View Full Code Here

        this.configuration = configuration;
    }

    /** {@inheritDoc} */
    public synchronized void start(StartContext context) throws StartException {
        final JMSServerManager jmsManager = jmsServer.getValue();
        try {
            jmsManager.createConnectionFactory(false, configuration, configuration.getBindings());
        } catch (Exception e) {
            throw new StartException("failed to create connection-factory", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.hornetq.jms.server.JMSServerManager

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.