Examples of JMSServerManager


Examples of org.hornetq.jms.server.JMSServerManager

        this.jndi = jndi;
    }

    @Override
    public synchronized void start(final StartContext context) throws StartException {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.createQueue(false, queueName, selectorString, durable, jndi);
                    queue = new HornetQQueue(queueName);
                    context.complete();
                } catch (Throwable e) {
                    context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "queue"));
                }
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

        }
    }

    @Override
    public synchronized void stop(final StopContext context) {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.removeQueueFromJNDI(queueName);
                    queue = null;
                } catch (Throwable e) {
                    MESSAGING_LOGGER.failedToDestroy(e, "queue", queueName);
                }
                context.complete();
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

                    final ServiceName hqServiceName = MessagingServices.getHornetQServiceName(PathAddress.pathAddress(operation.get(ModelDescriptionConstants.OP_ADDR)));
                    final ServiceName jmsManagerServiceName = JMSServices.getJmsManagerBaseServiceName(hqServiceName);

                    final ServiceController<?> jmsServerService = context.getServiceRegistry(false).getService(jmsManagerServiceName);
                    if (jmsServerService != null) {
                        JMSServerManager jmsServerManager = JMSServerManager.class.cast(jmsServerService.getValue());

                        if (jmsServerManager == null) {
                            PathAddress address = PathAddress.pathAddress(operation.require(OP_ADDR));
                            throw ControllerLogger.ROOT_LOGGER.managementResourceNotFound(address);
                        }

                        try {
                            if (addOperation) {
                                addJndiName(jmsServerManager, resourceName, jndiName);
                            } else {
                                removeJndiName(jmsServerManager, resourceName, jndiName);
                            }
                        } catch (Exception e) {
                            context.getFailureDescription().set(e.getLocalizedMessage());
                        }

                    } // else the subsystem isn't started yet

                    if (!context.hasFailureDescription()) {
                        context.getResult();
                    }

                    context.completeStep(new OperationContext.RollbackHandler() {
                        @Override
                        public void handleRollback(OperationContext context, ModelNode operation) {
                            if (jmsServerService != null) {
                                JMSServerManager jmsServerManager = JMSServerManager.class.cast(jmsServerService.getValue());

                                try {
                                    if (addOperation) {
                                        removeJndiName(jmsServerManager, resourceName, jndiName);
                                    } else {
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

        this.configuration = configuration;
    }

    /** {@inheritDoc} */
    public synchronized void start(final StartContext context) throws StartException {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.createConnectionFactory(false, configuration, configuration.getBindings());
                    context.complete();
                } catch (Throwable e) {
                    context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "connection-factory"));
                }
            }
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

        }
    }

    /** {@inheritDoc} */
    public synchronized void stop(final StopContext context) {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.destroyConnectionFactory(name);
                } catch (Throwable e) {
                    MESSAGING_LOGGER.failedToDestroy("connection-factory", name);
                }
                context.complete();
            }
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

        this.jndi = jndi;
    }

    @Override
    public synchronized void start(final StartContext context) throws StartException {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.createTopic(false, name, jndi);
                    topic = new HornetQTopic(name);
                    context.complete();
                } catch (Throwable e) {
                    context.failed(MessagingLogger.ROOT_LOGGER.failedToCreate(e, "queue"));
                }
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

        }
    }

    @Override
    public synchronized void stop(final StopContext context) {
        final JMSServerManager jmsManager = jmsServer.getValue();
        final Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    jmsManager.removeTopicFromJNDI(name);
                    topic = null;
                } catch (Throwable e) {
                    MESSAGING_LOGGER.failedToDestroy(e, "jms topic", name);
                }
                context.complete();
View Full Code Here

Examples of org.hornetq.jms.server.JMSServerManager

      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

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

Examples of org.hornetq.jms.server.JMSServerManager

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