code refactoring for jms application