code: protected void checkVersion(VersionedMessage<T> versionedMessage, String messageJson) {
          int comp = versionedMessage.compareVersion(expectedVersion);
  
          // message has newer version
          if (comp > 0) {
              String msg =
                      String.format(VERSION_MISMATCH_MSG, expectedVersion, versionedMessage.getVersion(), messageJson);
              notificationLogger.error(msg);
              throw new IncompatibleVersionException(msg);
          }
  
          // message has older version
          if (comp < 0) {
              notificationLogger.info(String.format(VERSION_MISMATCH_MSG, expectedVersion, versionedMessage.getVersion(),
                      messageJson));
          }
      }
docs: Check the message version against the expected version.
  
  @param versionedMessage  the versioned message
  @param messageJson       the notification message json
  
  @throws IncompatibleVersionException  if the message version is incompatable with the expected version