clustering

How to invoke broadcast EJB at all JBoss cluster members

According to a title, if have to invoke all ejb beans of a given type at once on all cluster members, below is a quiet simple way how to do it.

1. Import into your project required modules/dependencies

Maven dependencies

Runtime JBoss modules depencies

Defined  jboss-deployment-strucutre.xml file:

Dependencies might be alternatively defined in MANIFEST.MF as entry:

2.  Implement service that will invoke method on all cluster members

 Important notes on implementation:

  • JmsAdapter is an @Stateless EJB
  • Broadcast method is invoked synchronously on all cluster members, but there is an async equivalent : callAsynchMethodOnCluster
  • Implementation of broadcast requires private JBoss modules which are not supported by Red Hat

 

Managing HornetQ queues via JMS API

HornetQ offers a lot of resource management operations, but unfortunately it is not well covered by documentation ;(
In following tutorial I will try to show you how to manage HornetQ queue via JMS API.

1. Add hornetQ dependencies:

  • As library is available at JBoss AS, I personally prefer to add dependency at scope provided and include module dependency in MANIFEST.MF file
  • In case of debugging, consider adding also artifacts hornetq-server, hornetq-jms-server
2. Add class that will handle invocation of management operations:

3. Invoke adapter from previous point:

  • pay attention at queue address, because jms queues  should starts with prefix jms.queue.*
  • in case of operations parameters, add them as varargs

In the next post I have explained how to find out which management operations are available.

 

Mod_cluster on RHEL7

Yesterday I had to configure mod_cluster on Red Hat Enterprise Linux 7. As I’ve found out, it is not as simple, as it sounds. After hours of struggling with different approaches, I came up with following solution:

1. Download Apache with modcluster

wget downloads.jboss.org/mod_cluster//1.3.1.Final/linux-x86_64/mod_cluster-1.3.1.Final-linux2-x64-ssl.tar.gz

2. Untar archive and move to appropriate directory

tar -xvf mod_cluster-1.3.1.Final-linux2-x64-ssl.tar.gz mv opt/jboss /opt

3. Check if httpd deamon works correctly:

/opt/jboss/httpd/sbin/httpd -k start

if daemon works correctly, on http://localhost:6666 should be displayed famous “It works!”.

4. Make a system service from httpd

nano /etc/init.d/apache2.sh

and paste following content:

5. Add execute permissions for newly created script:

chmod +x /etc/init.d/apache2

6. Check if service is working correctly by invoking:

service apache2 start

7. If you would like to start service automatically at system startup, invoke:

chkconfig --add apache2