2 Replies Latest reply on Jul 12, 2013 7:57 AM by erasmo2 marciano2

    Help me Jms HornetQ DiscoveryGroupConfiguration

    erasmo2 marciano2 Master



      I have configured cluster Jms Jboss7  it works correctly.


      I have problem with my client in Java


      I should add this code


                 DiscoveryGroupConfiguration groupConfiguration = new DiscoveryGroupConfiguration(groupAddress, groupPort);

                  connectionFactory = (ConnectionFactory)HornetQJMSClient.createConnectionFactoryWithHA(groupConfiguration, JMSFactoryType.QUEUE_CF);



      In this code (I do not know how to do it)



                  // Set up the context for the JNDI lookup


                  final Properties env = new Properties();


                  env.put(Context.PROVIDER_URL, System.getProperty(Context.PROVIDER_URL, PROVIDER_URL));

                  env.put(Context.SECURITY_PRINCIPAL, System.getProperty("username", DEFAULT_USERNAME));

                  env.put(Context.SECURITY_CREDENTIALS, System.getProperty("password", DEFAULT_PASSWORD));

                  context = new InitialContext(env);



                  // Perform the JNDI lookups

                  String connectionFactoryString = System.getProperty("connection.factory", DEFAULT_CONNECTION_FACTORY);

                  log.info("Attempting to acquire connection factory \"" + connectionFactoryString + "\"");

                  connectionFactory = (ConnectionFactory) context.lookup(connectionFactoryString);

                  log.info("Found connection factory \"" + connectionFactoryString + "\" in JNDI");


                  String destinationString = System.getProperty("destination", DEFAULT_DESTINATION);

                  log.info("Attempting to acquire destination \"" + destinationString + "\"");

                  destination = (Destination) context.lookup(destinationString);

                  log.info("Found destination \"" + destinationString + "\" in JNDI");


                  // Create the JMS connection, session, producer, and consumer

                  connection = connectionFactory.createConnection(System.getProperty("username", DEFAULT_USERNAME), System.getProperty("password", DEFAULT_PASSWORD));


                  session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

                  producer = session.createProducer(destination);

                  consumer = session.createConsumer(destination);



                  int count = Integer.parseInt(System.getProperty("message.count", DEFAULT_MESSAGE_COUNT));

                  String content = System.getProperty("message.content", DEFAULT_MESSAGE);


                  log.info("Sending " + count + " messages with content: " + content);



      Someone can help me?


      My goal is to create a clinet JMS that is connect al


          //DiscoveryGroup my cluster

          final static String groupAddress = "";

          final static int groupPort = 9876;




      Thank a lot