Basically, you want to use HA-JNDI to look up the ConnectionFactory and Queue.
At http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossMQHAOverview there is a section where it talks about an example app, including client code. You have to follow some hyperlinks to get to the example. I haven't looked at that example, but it may be useful.
I had seen this example, but it is hosted in a jboss, and the client connects to the local HA-JNDI.
With my standalone app I have to connect to an active Jboss of the cluster, and in case of disconnect because the server is down I'll have to reconnect to another server of the cluster, even if a use the HA-JNDI
When you're looking up the queue, you need to use HA-JNDI with a URL that points to all of the nodes in the cluster. E.g. For a three node cluster the JNDI URL could be:
The client will then try each server in turn until it reaches one. There is autodiscovery too, but I've never used that - this works for us and if it ain't broke.. :-)
See Section 4 in the Clustering Guide documentation (specifically "HA-JNDI client and autodiscovery").