<?xml version='1.0' encoding='UTF-8'?>
<!-- See src/resources/configuration/ReadMe.txt for how the configuration assembly works -->
<config default-supplement="default">
    <extension-module>org.jgroups.extension</extension-module>
    <subsystem xmlns="urn:infinispan:server:jgroups:8.0">
        <channels default="cluster">
            <channel name="cluster" />
            <?CHANNELS?>
        </channels>
        <stacks default="${jboss.default.jgroups.stack:udp}">
            <stack name="udp">
                <?UDP-TRANSPORT?>
                <protocol type="PING" />
                <protocol type="MERGE3" />
                <protocol type="FD_SOCK" socket-binding="jgroups-udp-fd" />
                <protocol type="FD_ALL" />
                <protocol type="VERIFY_SUSPECT" />
                <protocol type="pbcast.NAKACK2" />
                <protocol type="UNICAST3" />
                <protocol type="pbcast.STABLE" />
                <protocol type="pbcast.GMS" />
                <protocol type="UFC" />
                <protocol type="MFC" />
                <protocol type="FRAG2" />
                <?RELAY?>
                <?AUTH?>
            </stack>
            <stack name="tcp">
                <?TCP-TRANSPORT?>
                <protocol type="MPING" socket-binding="jgroups-mping" />
                <protocol type="MERGE3" />
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd" />
                <protocol type="FD_ALL" />
                <protocol type="VERIFY_SUSPECT" />
                <protocol type="pbcast.NAKACK2">
                    <property name="use_mcast_xmit">false</property>
                </protocol>
                <protocol type="UNICAST3" />
                <protocol type="pbcast.STABLE" />
                <protocol type="pbcast.GMS" />
                <protocol type="MFC" />
                <protocol type="FRAG2" />
                <?AUTH?>
            </stack>
            <stack name="tcp-gossip">
                <?TCP-TRANSPORT?>
                <protocol type="TCPGOSSIP">
                   <property name="initial_hosts">${jgroups.gossip.initial_hosts:}</property>
                </protocol>
                <protocol type="MERGE3" />
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd" />
                <protocol type="FD_ALL" />
                <protocol type="VERIFY_SUSPECT" />
                <protocol type="pbcast.NAKACK2">
                   <property name="use_mcast_xmit">false</property>
                </protocol>
                <protocol type="UNICAST3" />
                <protocol type="pbcast.STABLE" />
                <protocol type="pbcast.GMS" />
                <protocol type="MFC" />
                <protocol type="FRAG2" />
                <?AUTH?>
            </stack>
            <stack name="s3">
                <?TCP-TRANSPORT?>
                <protocol type='S3_PING'>
                    <property name="location">${jgroups.s3.bucket:}</property>
                    <property name="access_key">${jgroups.s3.access_key:}</property>
                    <property name="secret_access_key">${jgroups.s3.secret_access_key:}</property>
                    <property name="pre_signed_delete_url">${jgroups.s3.pre_signed_delete_url:}</property>
                    <property name="pre_signed_put_url">${jgroups.s3.pre_signed_put_url:}</property>
                    <property name="prefix">${jgroups.s3.prefix:}</property>
                </protocol>
                <protocol type="MERGE3" />
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd" />
                <protocol type="FD_ALL" />
                <protocol type="VERIFY_SUSPECT" />
                <protocol type="pbcast.NAKACK2">
                    <property name="use_mcast_xmit">false</property>
                </protocol>
                <protocol type="UNICAST3" />
                <protocol type="pbcast.STABLE" />
                <protocol type="pbcast.GMS" />
                <protocol type="MFC" />
                <protocol type="FRAG2" />
            </stack>
            <stack name="google">
                <?TCP-TRANSPORT?>
                <protocol type='GOOGLE_PING'>
                    <property name="location">${jgroups.google.bucket:}</property>
                    <property name="access_key">${jgroups.google.access_key:}</property>
                    <property name="secret_access_key">${jgroups.google.secret_access_key:}</property>
                </protocol>
                <protocol type="MERGE3" />
                <protocol type="FD_SOCK" socket-binding="jgroups-tcp-fd" />
                <protocol type="FD_ALL" />
                <protocol type="VERIFY_SUSPECT" />
                <protocol type="pbcast.NAKACK2">
                    <property name="use_mcast_xmit">false</property>
                </protocol>
                <protocol type="UNICAST3" />
                <protocol type="pbcast.STABLE" />
                <protocol type="pbcast.GMS" />
                <protocol type="MFC" />
                <protocol type="FRAG2" />
            </stack>
        </stacks>
    </subsystem>

    <supplement name="default">
        <replacement placeholder="UDP-TRANSPORT">
            <transport type="UDP" socket-binding="jgroups-udp" />
        </replacement>
        <replacement placeholder="TCP-TRANSPORT">
            <transport type="TCP" socket-binding="jgroups-tcp" />
        </replacement>
    </supplement>

    <!-- Examples -->
    <supplement name="topology">
        <replacement placeholder="UDP-TRANSPORT">
            <transport type="UDP" socket-binding="jgroups-udp" site="${jboss.jgroups.topology.site:s1}" rack="${jboss.jgroups.topology.rack:r1}"
                machine="${jboss.jgroups.topology.machine:m1}" />
        </replacement>
        <replacement placeholder="TCP-TRANSPORT">
            <transport type="TCP" socket-binding="jgroups-tcp" site="${jboss.jgroups.topology.site:s1}" rack="${jboss.jgroups.topology.rack:r1}"
                machine="${jboss.jgroups.topology.machine:m1}" />
        </replacement>
    </supplement>

    <supplement name="xsite">
        <replacement placeholder="CHANNELS">
            <channel name="xsite" stack="tcp"/>
        </replacement>
        <replacement placeholder="UDP-TRANSPORT">
            <transport type="UDP" socket-binding="jgroups-udp" />
        </replacement>
        <replacement placeholder="TCP-TRANSPORT">
            <transport type="TCP" socket-binding="jgroups-tcp" />
        </replacement>
        <replacement placeholder="RELAY">
            <relay site="LON">
                <remote-site name="NYC" channel="xsite" />
                <remote-site name="SFO" channel="xsite" />
                <!-- property name="can_become_site_master">true</property> 
                <property name="max_site_masters">2</property -->
            </relay>
        </replacement>
    </supplement>

    <supplement name="auth">
        <replacement placeholder="AUTH">
            <sasl security-realm="ApplicationRealm" mech="DIGEST-MD5" cluster-role="cluster">
                <property name="client_password">${VAULT::cluster::password::1}</property>
            </sasl>
        </replacement>
    </supplement>

    <socket-binding name="jgroups-mping" port="0" multicast-address="${jboss.default.multicast.address:234.99.54.14}" multicast-port="45700" />
    <socket-binding name="jgroups-tcp" port="7600" />
    <socket-binding name="jgroups-tcp-fd" port="57600" />
    <socket-binding name="jgroups-udp" port="55200" multicast-address="${jboss.default.multicast.address:234.99.54.14}" multicast-port="45688" />
    <socket-binding name="jgroups-udp-fd" port="54200" />
</config>
