docs: @Override
      public void onMessage(Message message) {
          MDC.put("name", name);
          try {
              // Make sure thread priority is correct
              if (!Thread.currentThread().getName().equals(thread.getName())) {
                  Thread.currentThread().setName(thread.getName());
                  Thread.currentThread().setPriority(thread.getPriority());
              }
  
              // Get the message details
              String text = ((TextMessage) message).getText();
              JsonSimple config = new JsonSimple(text);
              String event = config.getString(null, "event");
              if (event == null) {
                  log.error("Invalid message received: '{}'", text);
                  return;
              }
  
              // Commit on the index
              if (event.equals("commit")) {
                  log.debug("Commit received");
                  submitBuffer(true);
              }
              // Index the incoming document
              if (event.equals("index")) {
                  String index = config.getString(null, "index");
                  String document = config.getString(null, "document");
                  if (index == null || document == null) {
                      log.error("Invalid message received: '{}'", text);
                      return;
                  }
                  addToBuffer(index, document);
              }
  
          } catch (JMSException jmse) {
              log.error("Failed to send/receive message: {}", jmse.getMessage());
          } catch (IOException ioe) {
              log.error("Failed to parse message: {}", ioe.getMessage());
          }
      }