We wrote a JCA compliant JGroups adapters which allows you to pool your jgroups channels and have the config neatly in a seperate ds xml file (all the great attributes of JCA).
I have attached both the rar (with source code in it) with a sample configuration file. This was written some time ago, so please excuse any "interesting" code. Note that this is using the old JCA spec, so it is a bit clumsy in places.
Some sample code on how to use it (Please note that the ServiceLocator, which is not provided, does a stock standard lookup for a given JNDI name):
BroadCastAdapterFactory adapterFactory = (BroadCastAdapterFactory)ServiceLocator.getInstance().getService("MyChannel1");BroadCastAdapter adapter = adapterFactory.getConnection();JChannel channel = adapter.getChannel();....// release the connection back to the pooladapter.close();
We have this deployed on jboss 4.2.3.
The benefits of such a connector is that
a) you can externalise your jgroups configuration fileb) you can change your configuration runtimec) you can control the number of connections which use the jgroups connectiond) you can easily create many different channels referenced with a JNDI name (we have 3 channels configured)d) ... all the jca related benefits that come with it.
There are plans to migrate this over to the new JCA specification (which will also allow it to be used standalone). I will publish the code when it is done.