How I can configure an failover on Jboss or Horneq?
erasmomarciano Jul 11, 2013 3:44 AMHI
I Have this client jms
final int groupPort = 9876;
try {
Queue queue = new HornetQQueue("testQueue");
Map<String, Object> connectionParams = new HashMap<String, Object>();
connectionParams.put(TransportConstants.CLUSTER_CONNECTION, "231.7.7.7:9876");
//connectionParams.put(TransportConstants.PORT_PROP_NAME, 5445);
TransportConfiguration transportConfiguration = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams);
// ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(JMSFactoryType.QUEUE_CF, transportConfiguration);
ConnectionFactory cf = (ConnectionFactory) HornetQJMSClient.createConnectionFactoryWithoutHA(new DiscoveryGroupConfiguration(groupAddress, groupPort), JMSFactoryType.QUEUE_CF);
//JBoss requires passwords to have at least one numeric and non-alpha character
connection = cf.createConnection("admin","erasmo");
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = session.createProducer(queue);
connection.start();
TextMessage message = session.createTextMessage("Howdy!");
//producer.send(message);
MessageConsumer consumer = session.createConsumer(queue);
//Message can also be consumed from here:
for (int i = 0; i < 1000; i++) {
message = (TextMessage) consumer.receive(3000);
LOGGER.info(message.getText());
}
But when the messages end on node 1
I get this message
lug 11, 2013 9:39:34 AM org.jboss.as.quickstarts.jms.MyJMSClient main
SEVERE: null
But the node 2 have other messages.
If I run for second time my client I consume the messages in node2
I'll probably have to confgiure a Failover but I don't Idea
can I help me?