Both types of StorageManagers implement the same set of interfaces. So the difference comes in the way they are implemented.
InMemory Storage Managers are expected to give a fast in-memory storage mechanism while Persistent Storage Managers are expected to store the data in a persistent manner, most probably in a database.
In Sandesha2 module.xml you can mention the two Storage Manager classes as given in the example below.
<wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" >
<!-- Other policies -->
Sandesha2 will load both the Storage Managers in the module initialization. Note that this is currently a system wide property. Therefore Sandesha2 will pick one storage Manager as the affective one when the system starts.
If you want Sandesha2 to use the InMemory Storage Manager and keep all the data in the memory, add the following property to the axis2.xml file:
<parameter name="Sandesha2StorageManager" locked="false">inmemory</parameter>If you want Sandesha2 to use the Persistent Storage Manager, set that property as follows:
<parameter name="Sandesha2StorageManager" locked="false">persistent</parameter>
Apache Sandesha2/Java versions post 1.0