You can check if the container is running in the listener itself at the most critical point of message handling for your business logic and throw an error if it is not running. If i were you i wouldn't intervene a thread managed by container.