1. A computer-implemented method of providing security for an application running on a messaging based operating system, the method comprising: receiving an indication from the application indicative of one or more types of messages which are considered to be potential security threats to the application and registering the one or more types of messages as potential security threats by storing data indicative of the one or more types of messages in a database; after registering the one or more types of messages as potential security threats, obtaining a first message from a message queue for the application; determining whether the first message is of a type registered by the application as being a potential security threat based on the data indicative of the one or more types of messages; and processing the first message, using a processor of a computer by: performing a callback to a callback function of the application if it was determined that the first message is of a type requested by the application as a potential security threat; receiving a return value from the callback function of the application; determining whether to prevent the first message based upon the return value from the callback function of the application; preventing the first message and causing the next message in the message queue to be obtained if it is determined to prevent the first message based upon the return value; and calling the application process for handling the first message if it is determined not to prevent the first message based upon the return value.