Uncategorized

List of HornetQ management operations

In previous post I have written tutorial how to invoke management operation on HornetQ server via JMS queue. But what operations are available?

Managed resources:

First of all, to invoke operation, you have to specify managed resource name, which start from prefix defined in org.hornetq.api.core.management.ResourceNames.

If your resource has one of the prefix defined below, there is a big chance that it can be managed via management queue:

 List of management operations for Queue:

Managment operations are the methods that are defined in org.hornetq.api.core.management.QueueControl interface:
http://grepcode.com/file/repo1.maven.org/maven2/org.hornetq/hornetq-core-client/2.3.15.Final/org/hornetq/api/core/management/QueueControl.java

e.g. to move all messages to DLQ you should invoke

 

 List of management operations for HornetQServer:

Managment operations are the methods that are defined in org.hornetq.api.core.management.HornetQServerControl interface:
http://grepcode.com/file/repo1.maven.org/maven2/org.hornetq/hornetq-core-client/2.3.15.Final/org/hornetq/api/core/management/HornetQServerControl.java

 List of management operations for HornetQ cluster:

Managment operations are the methods that are defined in org.hornetq.api.core.management.ClusterConnectionControlinterface:
http://grepcode.com/file/repo1.maven.org/maven2/org.hornetq/hornetq-core-client/2.3.15.Final/org/hornetq/api/core/management/ClusterConnectionControl.java

 

Others management operations are also available, just check content of package org.hornetq.api.core.management.

Pay special attention on parameters of the operation, as they must always match perfectly! If operations requires java.lang.String parameter and you dont’t provide it, operation will not be found.

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

 

 

 

How to inject mock into CDI context with Arquillian behind the scenes

 

My goal was to mock database, so every component in CDI based application would use mock instead of original implementation. I also had to have possibility to control my mock in JUnit test runtime. I struggle with this problem almost whole day and finally found satisfying solution :)

Not all steps are necessary, but I strongly encourage You to follow all of them.

1. Create stereotype for your mocked objects

2. Register newly created stereotype

3. Create mock factory

4. Write unit test