ActiveMQ broker listed in remote process - not able to find installation path - activemq

I have a kind of black-box application as it was developed by vendor. I could see all the topic and queues when I login to JConsole with this URL as remote process localhost:35099, but I am not seeing the ActiveMQ installation directory.
Is there any way to verify how broker is installed or determine which JVM it uses? What other things do I need to look out to figure out the ActiveMQ details?

The broker runs as a Java process, so you can find where the base directory of the running process, and then look for the data directory (sometimes the data is moved to a different location).
For the java.home location (ie ActiveMQ's operating base directory)
java.lang:type=Runtime
Look on the attribute:
SystemProperties
It's type is 'javax.management.openmbean.TabularDataSupport. Click into it.. then scroll through the list until you find the SystemProperty
java.home
There should be a JMX bean for the broker:
org.apache.activemq:type=Broker,brokerName=.. your broker name..
Then look for the attribute to see where data is stored:
DataDirectory /opt/activemq/../data

Related

How to manually deploy Mule application package on the on-premises cluster?

I'm looking for the advice of how to manually (i.e. without using Runtime Manager - RM) deploy a mule application package on the on-premises Mule cluster. The official documentation suggests using the RM for the purpose either via the gui or cli or api. However, the RM is not available on our environment.
I can manually deploy the package on a single node by copying it to the /apps folder. But this way the application is only deployed on a single node, not on the cluster.
I've tried using the AMC agent rest API for the purpose with the same result - it only deploys on a single node.
So, what's the correct way of manually deploying a mule application on the Mule servers cluster without using Anypoint RM?
We are on Mule 4.4 EE.
Copy the application jar file into the apps directory of every node. Mule clusters do not transfer applications between nodes.
Alternatively ou can use the Runtime Manager Agent instead however it also works in a per node basis. You need to send the same request to each node to deploy.
Each connector may or may not be cluster aware. Read each connector documentation to understand how they behave. In particular the documentation of the VM connector states:
When running in cluster mode, persistent queues are instead backed by the memory grid. This means that when a Mule flow uses VM Connector to publish content to a queue, Mule runtime engine (Mule) decides whether to process that message in the same origin node or to send it out to the cluster to be picked up and processed by another node.
You can register the multiple nodes through AMC agent on the cloudhub control plane and create a server group and deploy code through control plain runtime manager it does the job of deployment to same app in n nodes

ActiveMQ Browser V2.5.2.8 can't connect to ActiveMQ V5.12.1

I tried to connect to ActiveMQ V5.12.1 with ActiveMQ Browser V2.5.2.8, they are installed on the same computer. but failed.
ActiveMQ Browser always complaining
/*
Could not start QBrowserV2
Failed to connect to ActiveMQ JMX Server.
*/
I followed its instruction to use Jms=true on broker elment of activemq.xml,
also set connectorPort="10000", rmiServerPort="10001" on managementContext element.
I left other configuations default and restart activemq by double clicking the activemq.bat file which located under ACTIVEMQ_HOME\bin\win64
but still no luck.
Meanwhile, I noticed that i can use jconsole to connect ActiveMQ successfully.
Anyone had met same problems? What I want to use ActiveMQ Browser is to monitor the incoming messages, when it is not consumed by subscriber and is in dispatched queue, I want to extract the concrete message contents.
I checked the question, but it is Activemq 5.8.0.
Apache ActiveMQ browser can't connect to JMX console
I had this problem now with ActiveMQ 5.13.4 and my problem was that I didn't copy the correct activemq jar files to AvtiveMQBrowser folder.
https://sourceforge.net/p/activemqbrowser/discussion/962581/thread/464131a8/#0ce4
Copy activemq-all-<version>.jar from the <installation folder> of ActiveMQ broker to ActiveMQBrowser_<version> folder.
Copy activemq-web-<version>.jar from the <installation folder>/lib of ActiveMQ broker to ActiveMQBrowser_<version> folder.
Update run_activemq_browser.bat with paths to the correct activeMQ jar files including correct version number.
The above steps allowed me to connect.

Get Number of connection from all host to my activemq broker

ActiveMQ broker setup:
Broker is running on machine: hostA
Clients from different host can connect to my broker instance running on hostA, there can be any number of client from any host.
Is there a way to find out how many clients are connected to broker and also list which tell me how many connection from each host is there to my broker.
I want to do this without making assumption about number of hosts.
I can do this by using lsof command and some parsing over output, but I am in situation where I can not use this.
Is there any feature provided by ActiveMQ command line utility activemq-admin.
You can get to pretty much any Mbean attribute ActiveMQ exposes via the activemq-admin. There are no attributes or operations that give you a quick count of connections from specific clients. You will have to do some work on your end to get all the details you want, but all the raw data is there.
Examples:
Broker Stats:
activemq-admin query --objname type=Broker,brokerName=localhost
Connection Stats
activemq-admin query --objname type=Broker,brokerName=localhost,connector=clientConnectors,connectorName=<transport connector name>,connectionViewType=clientId,connectionName=*
See full doc here.
NOTE: Documentation as of this writting has not be updated to take into account the Mbean changes made in AMQ. References to Object names in examples are not correct.
You can get the object name (or example sytax) from JMX (using jconsole or visual vm for example) from the MBeanInfo. Each object name wills stat something like org.apache.activemq:type. For the script, remove the "org.apache.activemq:" and you should be in business for any thing you need from JMX via the script.
I think you may also look into using Jolokia with your broker. Although not compatible with the activemq-admin script, you can reach everything you can from the activemq-admin script, but also have access to all of the operations. In the past I've heavily used the activemq-admin script for local monitoring/command line administration of the broker, but have started converting everything to hit the Jolokia service. But again, activemq-admin will give you a way to access what you are looking for here.

Multiple war in Tomcat 7 using a shared embedded ActiveMQ

I'm working on a project where I have several war files inside a tomcat 7 have to communicate with a single embedded activeMQ (5.5.1) broker inside the same Tomcat.
I'm wondering what was the best practice to manage this and how to start and stop the broker properly.
Actually I try tu use a global JNDI entry in server.xml and in each war gets my activemq connection with a lookup. The first connection to the broker implicitly starts it. But with this method I run into various problems like instance already existing or locks in data store.
Should I use instead an additional war which uses a BrokerFactory to start the broker explicitly? In this case how to make sure that this war executes first in Tomcat ? And how do I stop my broker and where?
Thanks for the help.
from the docs...
If you are using the VM transport and wish to explicitly configure an
Embedded Broker there is a chance that you could create the JMS
connections first before the broker starts up. Currently ActiveMQ will
auto-create a broker if you use the VM transport and there is not one
already configured. (In 5.2 it is possible to use the waitForStart and
create=false options for the connection uri)
So to work around this if you are using Spring you may wish to use the
depends-on attribute so that your JMS ConnectionFactory depends on the
embedded broker to avoid this happening. e.g.
see these pages for more information...
http://activemq.apache.org/vm-transport-reference.html
http://activemq.apache.org/how-do-i-embed-a-broker-inside-a-connection.html
http://activemq.apache.org/how-do-i-restart-embedded-broker.html

Why are my WebLogic clustered MDB app deployments in warning state?

I have a WebLogic cluster on which I've deployed numerous topics and applications that use them. My applications uniformly show themselves in a Warning status. Looking at Monitoring on the deployment, I see the MDB application connects to Server #1, but on server #2 it shows this:
MDB application appName is NOT connected to messaging system.
My JMS Server is targetted to a migratable target, which is in turn targetted to the #1 server and has a cluster identified. And messages sent to either server all flow as expected. I just don't know why these deployments show in a Warning state.
WebLogic 11g
This can be avoided by using the parameter below
<start-mdbs-with-application>false</start-mdbs-with-application>
In the weblogic-application.xml, Setting start-mdbs-with-application to false forces MDBs to defer starting until after the server instance opens its listen port, near the end of the server boot up process.
If you want to perform startup tasks after JMS and JDBC services are available, but before applications and modules have been activated, you can select the Run Before Application Deployments option in the Administration Console (or set the StartupClassMBean’s LoadBeforeAppActivation attribute to “true”).
If you want to perform startup tasks before JMS and JDBC services are available, you can select the Run Before Application Activations option in the Administration Console (or set the StartupClassMBean’s LoadBeforeAppDeployments attribute to “true”).
Refer :http://docs.oracle.com/cd/E13222_01/wls/docs81/ejb/message_beans.html
this is applicable for the versions till 12c and later
I don't like unanswered questions, so I'm going to answer this one.
The problem is resolved, though I was not involved in its resolution. At present the problem only exists for the length of time it takes the JMS subsystem to fully initialize. During that period (with many queues, it can take a while) the JNDI system throws errors and the apps are truly in warning state. Once the JMS is fully initialized, everything goes green.
My belief is that someone corrected something in the JMS Server / Cluster config. I'll never know what it was.