You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by George Christman <gc...@cardaddy.com> on 2018/06/29 16:00:31 UTC

Clustering using ActiveMQ and Tomcat

Hi Guys, I'm working with an older 5.4 application at work that I built a
few years back with Hibernate-Search. Recently management wanted to start
load balancing the app on our own network. This would require replication
and synchronization of the indexes using a master / slave configuration.

Hibernate Search doc shows there examples being used with JBOSS, we do use
tomcat, so I would be required to do some additional work on my end. Doc.
https://docs.jboss.org/hibernate/search/4.5/reference/en-US/html/search-configuration.html#jms-backend

I ran across these two articles.

https://forum.hibernate.org/viewtopic.php?p=2422173

and

https://developer.jboss.org/wiki/ClusteringUsingActiveMQAndTomcat

I'm struggling to understand how to implement the subclass of
AbstractJMSHibernateSearchController in the master application and register
it into the listener queue. Could someone please provide some pointers.?

"

Last step is to implement a subclass of
*AbstractJMSHibernateSearchController* in the master application. This
class has to register itself as listener to the queue. The code could look
somewhat like this:

   1.                 Context initCtx = new InitialContext();
   2.
   3.
   // Look up for connection factory & create connection, session
   4.
                   ConnectionFactory connectionFactory =
(ConnectionFactory) initCtx.lookup(
   "java:comp/env/jms/ConnectionFactory");
   5.                 connection = connectionFactory.createConnection();
   6.                 connection.start();
   7.                 javax.jms.Session session = connection.createSession(
   true, 0);
   8.
   9.                 // Look up for destination and set listner
   10.                 Queue queue = (Queue) initCtx.lookup(
   "java:comp/env/queue/hibernatesearch");
   11.
                   MessageConsumer consumer = session.createConsumer(queue);
   12.                 consumer.setMessageListener(this);

"

-- 
George Christman
Senior Engineer
www.CarDaddy.com