I should have said that the servlet is running on one JBoss cluster, the destinations are hosted on another, separate cluster. The two JBoss clusters are completely separate.
In the examples there's an example of sending a message from a web service (a servlet).
You just need to deploy a JMSProviderLoader pointing to your remote provider (there should be some wiki pages about this), then make sure you lookup the connection factory corresponding to this provide.
Should be pretty straightforward - this is a very common use case.
I agree it's straightforward and common but I don't seem to be able to get it to work for some reason. When I have my servlets, destinations and MDB deployed in the same cluster and use:
InitialContext ctx = new InitialContext();
I can access my destinations just fine.
(note: all the examples in the JBoss Messaging 1.3 doc use the same method of creating an InitialContext as shown above, none specify a URL belonging to a remote machine).
When I move the servlet to cluster1 and the destinations / MDB to cluster2, it stops working. I tried creating the InitialContext with a PROVIDER_URL that pointed Cluster2 i.e.
Properties h = new Properties();
h.put( Context.PROVIDER_URL, "jnp://cluster2:1099" );
InitialContext ctx = new InitialContext(h);
but this didn't work.
The application works if everything is deployed to a single JBoss server or to a single JBoss cluster but I can't get cluster to cluster working. That's the example I am looking for.