If a mail is send to my inbox, I recieve a message, and I'm inserting the contents into DB. I have a org.springframework.integration.core.Message something like follows:
public void receive(Message<?> message)
{
//I am inserting message contents into DB
}
Now in the event of failure, I wanted to have fail safe recovery mechanism, what I am thinking is to serialize the Message object into a file and later deserialize and update to DB.
Question 1. In this situation how to serialize the Message object? 2. Other than serialization any other mechanism that can be used?
EDIT I have not done Serialization before, I heard like the class should implements Serializable in order to use ObjectOutputStream, in this case I don't want to create a subclass of Message, So how to serialize Message to File?