basic-lib/src/main/java/com/streamsets/pipeline/stage/destination/mqtt/MqttClientTarget.java
String getTopic(Record record) throws StageException {
    String result = publisherConf.topic;
    if (publisherConf.runtimeTopicResolution) {
      RecordEL.setRecordInContext(topicVars, record);
      try {
        result = topicEval.eval(topicVars, publisherConf.topicExpression, String.class);
        if (isEmpty(result)) {
          throw new StageException(Errors.MQTT_08, publisherConf.topicExpression, record.getHeader().getSourceId());
        }
        if (!allowedTopics.contains(result) && !allowAllTopics) {
          throw new StageException(Errors.MQTT_09, result, record.getHeader().getSourceId());
        }
      } catch (ELEvalException e) {
        throw new StageException(
            Errors.MQTT_10,
            publisherConf.topicExpression,
            record.getHeader().getSourceId(),
            e.toString()
        );
      }
    }
    return result;
  }
String getTopic(Record record) throws StageException {
    String result = publisherConf.topic;
    if (publisherConf.runtimeTopicResolution) {
      RecordEL.setRecordInContext(topicVars, record);
      try {
        result = topicEval.eval(topicVars, publisherConf.topicExpression, String.class);
        if (isEmpty(result)) {
          throw new StageException(Errors.MQTT_08, publisherConf.topicExpression, record.getHeader().getSourceId());
        }
        if (!allowedTopics.contains(result) && !allowAllTopics) {
          throw new StageException(Errors.MQTT_09, result, record.getHeader().getSourceId());
        }
      } catch (ELEvalException e) {
        throw new StageException(
            Errors.MQTT_10,
            publisherConf.topicExpression,
            record.getHeader().getSourceId(),
            e.toString()
        );
      }
    }
    return result;
  }
Returns the topic given the record.

Returns the configured topic or statically evaluated topic in case runtime resolution is not required.

If runtime resolution is required then the following is done:
1. Resolve the topic name by evaluating the topic expression
2. If the white list does not contain topic name and white list is not configured with "*" throw StageException
and the record will be handled based on the OnError configuration for the stage