Warning: A non-numeric value encountered in /home/ricston2/public_html/blogarchive/wp-content/themes/Divi/functions.php on line 5766

When using the VM transport asynchronously, you might want to persist any pending messages before Mule is properly shut down. We talk about this in our Mule ESB Developer Training course and explain how to configure it. Last week, while lecturing, I got a question that I had not heard before.

I was asked what format is used to persist the messages to disk if I had to use the FilePersistenceStrategy. I had never looked into this so I opened the code and dived in.

The FilePersistenceStrategy allows you to save pending messages on a VM queue to disk and to therefore persist messages between Mule reboots. It does not store the information in XML but rather streams the item to disk directly.

The store () method for this class accepts an Object and will stream this out to disk:

public Object store(String queue, Object obj) throws IOException
    {
        ...
        ObjectOutputStream oos = new ObjectOutputStream(new
          FileOutputStream(file));
        oos.writeObject(obj);
        ...
    }