[id='jgroups_external-{context}']
= Using JGroups Stacks in External Files
You can use custom JGroups transport configuration from external files.

{brandname} looks for JGroups configuration files on your classpath first and
then for absolute path names.

.Declaratively

* Specify your JGroups transport configuration with the `stack-file` element.
+
[source,xml,options="nowrap",subs=attributes+]
----
include::config_examples/config_external_jgroups.xml[]
----
<1> adds the "prod-jgroups-tcp.xml" stack definition.
<2> configures {brandname} cluster to use the stack.

.Programmatically

* Specify your JGroups transport configuration with the `addProperty()` method.
+
[source,java]
----
include::code_examples/ConfigureTransport.java[]
----
<1> adds the "prod-jgroups-tcp.xml" stack definition as the default for the
cluster transport.

.Reference

* link:{javadocroot}/org/infinispan/configuration/global/GlobalConfigurationBuilder.html#transport()[GlobalConfigurationBuilder.transport()]
* link:{javadocroot}/org/infinispan/configuration/global/TransportConfigurationBuilder.html[TransportConfigurationBuilder]
