Small refactoring of the code retrieved from
http://alvinjayreyes.com/2012/03/26/jms-development-fundamentals-using-apache-activemq/