Refatoring JMS code