# JMS Colocated Failover Shared Store Example

    To run the example, simply type mvn verify from this directory. This example will always spawn and stop multiple servers.

This example demonstrates how you can colocate live and backup servers in the same VM. We do this by creating an HA Policy that is colocated. colocated means that backup servers can be created and maintained by live servers on behalf of other requesting live servers. In this example we create a colocated shared store server.

This example starts 2 live servers each with a backup server that backs up the other live server.

The first live server will be killed and the backup in the second will become live

The following shows how to configure the live servers to request and allow backups to be deployed

         <ha-policy>
             <shared-store>
                 <colocated>
                     <backup-port-offset>100</backup-port-offset>
                     <backup-request-retries>-1</backup-request-retries>
                     <backup-request-retry-interval>2000</backup-request-retry-interval>
                     <max-backups>1</max-backups>
                     <request-backup>true</request-backup>
                     <master/>
                     <slave/>
                 </colocated>
             </shared-store>
         </ha-policy>

notice that we have used a template to set some sensible defaults but overridden the backup strategy so back ups are full servers