code: private void disconnect() {
          if (this.session != null) {
              try {
                  this.session.close();
              } catch (Exception e) {
                  log.error("Error closing JMS topic session.", e);
              }
          }
          
          if (this.connection != null) {
              try {
                  this.connection.stop();
                  this.connection.close();
              } catch (Exception e) {
                  log.error("Error closing JMS topic connection.", e);
              }
          }
          
          this.session = null;
          this.connection = null;
      }
docs: Disconnect from the JMS server.