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 .