title: Best strategy to cache and store and then forward
body: <p>JVM(client) sends a lot of event data to another JVM(server) via ActiveMQ message queue. The ActiveMQ server is embedded in the server JVM. If the volume of the messages is too high the client JVM needs to keep the messages in a local memory cache and if the cache overflows it needs to persist the messages in the file system. Concurrently, another thread will need to read the data from the file/cache and send it to the server jvm.
  My question is: what is best way to implement this? Will memory mapped I/O help? I need to delete the data from the local file once it is gone to the server. </p>